diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-04-27 13:00:09 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-04-27 13:00:09 +0200 |
commit | d02260824e2cad626fb2a9d62e27006d34b6dedc (patch) | |
tree | 1d2ba45a6e1e871394b8f2035eece063f38e0a73 /sound/pci/emu10k1/emu10k1.c | |
parent | ALSA: hda - Add mute-LED mode control to Thinkpad (diff) | |
download | linux-d02260824e2cad626fb2a9d62e27006d34b6dedc.tar.xz linux-d02260824e2cad626fb2a9d62e27006d34b6dedc.zip |
ALSA: emu10k1: Fix card shortname string buffer overflow
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>
Diffstat (limited to 'sound/pci/emu10k1/emu10k1.c')
-rw-r--r-- | sound/pci/emu10k1/emu10k1.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index 37d0220a094c..db7a2e5e4a14 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c @@ -183,8 +183,10 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci, } #endif - strcpy(card->driver, emu->card_capabilities->driver); - strcpy(card->shortname, emu->card_capabilities->name); + strlcpy(card->driver, emu->card_capabilities->driver, + sizeof(card->driver)); + strlcpy(card->shortname, emu->card_capabilities->name, + sizeof(card->shortname)); snprintf(card->longname, sizeof(card->longname), "%s (rev.%d, serial:0x%x) at 0x%lx, irq %i", card->shortname, emu->revision, emu->serial, emu->port, emu->irq); |