Skip to content

Commit

Permalink
ALSA: gus: Replace unsafe strcpy() with strscpy()
Browse files Browse the repository at this point in the history
Fix smatch warning:
sound/isa/gus/gus_main.c:396 snd_gus_check_version() error:
 strcpy() 'card->longname' too large for 'card->shortname' (80 vs 32)

Even if this is not a real bug since the longest length of card->longname
now is 31, replace strcpy() with strscpy() in order to avoid possible
future mistake.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20210514070507.16600-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
YueHaibing authored and Takashi Iwai committed May 14, 2021
1 parent e73b4c9 commit bac5905
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/isa/gus/gus_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ static int snd_gus_check_version(struct snd_gus_card * gus)
}
}
}
strcpy(card->shortname, card->longname);
strscpy(card->shortname, card->longname, sizeof(card->shortname));
gus->uart_enable = 1; /* standard GUSes doesn't have midi uart trouble */
snd_gus_init_control(gus);
return 0;
Expand Down

0 comments on commit bac5905

Please sign in to comment.