summaryrefslogtreecommitdiff
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-10-29 15:20:06 +0100
committerTakashi Iwai <tiwai@suse.de>2013-10-29 15:20:06 +0100
commit97f44f56ca94709f45bc348f5d2c88696eae5f9b (patch)
treec732ad0aef8aa12e5b9817bed561403735924539 /sound/core
parent75415df8ffbac2ace9463ceffb3f21299af2548a (diff)
ALSA: Limit the fallback card id string size
When no proper id string is given, the driver tries to fall back to copy the proc_root name string via strcpy(), but this might overflow the fixed string size. Let's use strlcpy(). Spotted by coverity CID 139008. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index 01a89383a062..1351f22f651c 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -597,7 +597,7 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src,
/* last resort... */
snd_printk(KERN_ERR "unable to set card id (%s)\n", id);
if (card->proc_root->name)
- strcpy(card->id, card->proc_root->name);
+ strlcpy(card->id, card->proc_root->name, sizeof(card->id));
}
/**