ALSA: emu10k1: Fix card shortname string buffer overflow
authorTakashi Iwai <tiwai@suse.de>
Mon, 27 Apr 2015 11:00:09 +0000 (13:00 +0200)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 17 May 2015 23:12:36 +0000 (19:12 -0400)
commit79f0cbcc9a4287d966fd7fb259b3cb4f54f99913
tree8e029a91e206bf9479d80ce064b89c51aae8c77f
parent33b9b8ceb1cb2474c33dce3f366ffc947faf035c
ALSA: emu10k1: Fix card shortname string buffer overflow

[ Upstream commit d02260824e2cad626fb2a9d62e27006d34b6dedc ]

Some models provide too long string for the shortname that has 32bytes
including the terminator, and it results in a non-terminated string
exposed to the user-space.  This isn't too critical, though, as the
string is stopped at the succeeding longname string.

This patch fixes such entries by dropping "SB" prefix (it's enough to
fit within 32 bytes, so far).  Meanwhile, it also changes strcpy()
with strlcpy() to make sure that this kind of problem won't happen in
future, too.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
sound/pci/emu10k1/emu10k1.c
sound/pci/emu10k1/emu10k1_main.c