Skip to content

Commit 97f44f5

Browse files
committed
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>
1 parent 75415df commit 97f44f5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎sound/core/init.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src,
597597
/* last resort... */
598598
snd_printk(KERN_ERR "unable to set card id (%s)\n", id);
599599
if (card->proc_root->name)
600-
strcpy(card->id, card->proc_root->name);
600+
strlcpy(card->id, card->proc_root->name, sizeof(card->id));
601601
}
602602

603603
/**

0 commit comments

Comments
 (0)