summaryrefslogtreecommitdiff
path: root/sound/usb/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/stream.c')
-rw-r--r--sound/usb/stream.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index c1ea8844a46f..ad6ced780634 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -536,9 +536,10 @@ static int __snd_usb_add_audio_stream(struct snd_usb_audio *chip,
pcm->private_free = snd_usb_audio_pcm_free;
pcm->info_flags = 0;
if (chip->pcm_devs > 0)
- sprintf(pcm->name, "USB Audio #%d", chip->pcm_devs);
+ scnprintf(pcm->name, sizeof(pcm->name), "USB Audio #%d",
+ chip->pcm_devs);
else
- strcpy(pcm->name, "USB Audio");
+ strscpy(pcm->name, "USB Audio");
snd_usb_init_substream(as, stream, fp, pd);
@@ -987,6 +988,8 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
* and request Cluster Descriptor
*/
wLength = le16_to_cpu(hc_header.wLength);
+ if (wLength < sizeof(cluster))
+ return NULL;
cluster = kzalloc(wLength, GFP_KERNEL);
if (!cluster)
return ERR_PTR(-ENOMEM);