From 57a4451d26eef4ccbf3b32fd116295f001c18cb4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 29 Oct 2013 15:26:12 +0100 Subject: ALSA: Use strlcpy() instead of strncpy() We tend to make stupid mistakes with strncpy(). Let's take a safer one, strlcpy(). Signed-off-by: Takashi Iwai --- sound/pci/ice1712/psc724.c | 4 ++-- sound/pci/ice1712/wm8776.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sound/pci/ice1712') diff --git a/sound/pci/ice1712/psc724.c b/sound/pci/ice1712/psc724.c index 302ac6ddd545..4019cf27d117 100644 --- a/sound/pci/ice1712/psc724.c +++ b/sound/pci/ice1712/psc724.c @@ -203,12 +203,12 @@ static void psc724_set_jack_state(struct snd_ice1712 *ice, bool hp_connected) /* notify about master speaker mute change */ memset(&elem_id, 0, sizeof(elem_id)); elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strncpy(elem_id.name, "Master Speakers Playback Switch", + strlcpy(elem_id.name, "Master Speakers Playback Switch", sizeof(elem_id.name)); kctl = snd_ctl_find_id(ice->card, &elem_id); snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); /* and headphone mute change */ - strncpy(elem_id.name, spec->wm8776.ctl[WM8776_CTL_HP_SW].name, + strlcpy(elem_id.name, spec->wm8776.ctl[WM8776_CTL_HP_SW].name, sizeof(elem_id.name)); kctl = snd_ctl_find_id(ice->card, &elem_id); snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); diff --git a/sound/pci/ice1712/wm8776.c b/sound/pci/ice1712/wm8776.c index a3c05fe5daf9..5227cb08247f 100644 --- a/sound/pci/ice1712/wm8776.c +++ b/sound/pci/ice1712/wm8776.c @@ -52,7 +52,7 @@ static void snd_wm8776_activate_ctl(struct snd_wm8776 *wm, unsigned int index_offset; memset(&elem_id, 0, sizeof(elem_id)); - strncpy(elem_id.name, ctl_name, sizeof(elem_id.name)); + strlcpy(elem_id.name, ctl_name, sizeof(elem_id.name)); elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; kctl = snd_ctl_find_id(card, &elem_id); if (!kctl) -- cgit v1.2.3