summaryrefslogtreecommitdiffstats
path: root/sound/isa/gus
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2021-05-14 15:05:07 +0800
committerTakashi Iwai <tiwai@suse.de>2021-05-14 09:48:33 +0200
commitbac59054544ebdb89f05c5b9598ca9cb2dea72ce (patch)
tree1fc9856d353332f4b772b2865d4238a5e3e24459 /sound/isa/gus
parente73b4c9e7fa7fc8870d472b73a155e891f1f4022 (diff)
downloadlinux-stable-bac59054544ebdb89f05c5b9598ca9cb2dea72ce.tar.gz
linux-stable-bac59054544ebdb89f05c5b9598ca9cb2dea72ce.tar.bz2
linux-stable-bac59054544ebdb89f05c5b9598ca9cb2dea72ce.zip
ALSA: gus: Replace unsafe strcpy() with strscpy()
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>
Diffstat (limited to 'sound/isa/gus')
-rw-r--r--sound/isa/gus/gus_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index afc088f0377c..46bfc5ae17c0 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -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;