Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@zonque.org>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, Daniel Mack <daniel@zonque.org>
Subject: [PATCH 2/2] ALSA: snd-usb: use strncpy() in mixer_quirks.c
Date: Sun, 19 Oct 2014 09:11:26 +0200	[thread overview]
Message-ID: <1413702686-8751-2-git-send-email-daniel@zonque.org> (raw)
In-Reply-To: <1413702686-8751-1-git-send-email-daniel@zonque.org>

Out of principles, use strncpy() in favor of strcpy().
That is, however, an insignificant detail here.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 sound/usb/mixer_quirks.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index f119a41..f406305 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -446,8 +446,9 @@ static int snd_emu0204_ch_switch_info(struct snd_kcontrol *kcontrol,
 	uinfo->value.enumerated.items = 2;
 	if (uinfo->value.enumerated.item > 1)
 		uinfo->value.enumerated.item = 1;
-	strcpy(uinfo->value.enumerated.name,
-		texts[uinfo->value.enumerated.item]);
+	strncpy(uinfo->value.enumerated.name,
+		texts[uinfo->value.enumerated.item],
+		sizeof(uinfo->value.enumerated.name) - 1);
 
 	return 0;
 }
-- 
2.1.0

  reply	other threads:[~2014-10-19  7:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-19  7:11 [PATCH 1/2] ALSA: snd-usb: drop unused varible assigments Daniel Mack
2014-10-19  7:11 ` Daniel Mack [this message]
2014-10-19  9:38   ` [PATCH 2/2] ALSA: snd-usb: use strncpy() in mixer_quirks.c Takashi Iwai
2014-10-20 14:40     ` Takashi Iwai
2014-10-20 14:47       ` Daniel Mack
2014-10-19  9:36 ` [PATCH 1/2] ALSA: snd-usb: drop unused varible assigments Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1413702686-8751-2-git-send-email-daniel@zonque.org \
    --to=daniel@zonque.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox