aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-04-16 04:22:24 -0400
committerTakashi Iwai <tiwai@suse.de>2009-04-16 04:22:24 -0400
commit18cb7109d3e83195b605ff2905981020e86f72ca (patch)
tree7db1fa0c6ec8656a0a041bf9163b0656dd4a5765 /sound/pci/hda/hda_codec.c
parent4e01f54bfd3f423db8fd6c91c4f0471f18aa0c50 (diff)
ALSA: hda - Check strcpy length
Check the length to copy via strlen() beforehand to avoid the stack corruption, or use strlcpy() to be safe in HD-audio codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 37f24ce7c3a2..48f0cea7df14 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1431,6 +1431,8 @@ _snd_hda_find_mixer_ctl(struct hda_codec *codec,
1431 memset(&id, 0, sizeof(id)); 1431 memset(&id, 0, sizeof(id));
1432 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1432 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1433 id.index = idx; 1433 id.index = idx;
1434 if (snd_BUG_ON(strlen(name) >= sizeof(id.name)))
1435 return NULL;
1434 strcpy(id.name, name); 1436 strcpy(id.name, name);
1435 return snd_ctl_find_id(codec->bus->card, &id); 1437 return snd_ctl_find_id(codec->bus->card, &id);
1436} 1438}