From: Takashi Iwai Subject: Re: [PATCH 3/5] ALSA: snd_usb_caiaq: use strncpy Date: Mon, 01 Jun 2009 10:32:21 +0200 Message-ID: References: <1243719865-26760-1-git-send-email-daniel@caiaq.de> <1243719865-26760-2-git-send-email-daniel@caiaq.de> <1243719865-26760-3-git-send-email-daniel@caiaq.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id D2E1D24562 for ; Mon, 1 Jun 2009 10:32:21 +0200 (CEST) In-Reply-To: <1243719865-26760-3-git-send-email-daniel@caiaq.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Daniel Mack Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Sat, 30 May 2009 23:44:23 +0200, Daniel Mack wrote: > > Signed-off-by: Daniel Mack You should use strlcpy() instead of strncpy(). The latter doesn't terminate the oversized string. Takashi > --- > sound/usb/caiaq/device.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c > index 7fdecde..f8915a5 100644 > --- a/sound/usb/caiaq/device.c > +++ b/sound/usb/caiaq/device.c > @@ -432,8 +432,8 @@ static int __devinit init_card(struct snd_usb_caiaqdev *dev) > if (c) > *c = '\0'; > > - strcpy(card->driver, MODNAME); > - strcpy(card->shortname, dev->product_name); > + strncpy(card->driver, MODNAME, sizeof(card->driver)); > + strncpy(card->shortname, dev->product_name, sizeof(card->shortname)); > > /* fill card->id with a shortened version of the product string > * which does not contain any whitespaces */ > -- > 1.6.3.1 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel >