From patchwork Fri Jul 17 15:41:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 36029 X-Patchwork-Delegate: dougsland@redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6HFdjAO013533 for ; Fri, 17 Jul 2009 15:39:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964790AbZGQPjk (ORCPT ); Fri, 17 Jul 2009 11:39:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964800AbZGQPjk (ORCPT ); Fri, 17 Jul 2009 11:39:40 -0400 Received: from mail-ew0-f226.google.com ([209.85.219.226]:53038 "EHLO mail-ew0-f226.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964790AbZGQPjj (ORCPT ); Fri, 17 Jul 2009 11:39:39 -0400 Received: by ewy26 with SMTP id 26so952373ewy.37 for ; Fri, 17 Jul 2009 08:39:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=deJesM56AVxJg/PdbWIheD5cRkWgxwxhzelsb5Qo7lc=; b=VlkPtMuHHxaQywgM+GtzJFKEm7LS5iaUhpjK6a4dsrA7ZnKKjE3I8g0f7J+Cfs1AA/ TON3+KuD4ftA96OjRPviXfH7+PbQtg3Ab5rOL33TcQ6wHLYvmsul0yy/JjLPu4URq/ht D109qLJ17SB/x3r3FWSKcn+uXTS6zCxAZ2xAA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=XTcpXWBe93Tbha+O/69bhuQMXrFN423KL+OM6k/gnABnCqzFXH1jaHth1HAg/3SfLA nGxOXJYTZ134DvOmJI6R2PUnl+h6rvnRZG8VRUJyWUOZhO4heuj53yz0sajS//ryiQm6 GC1tTWNIfTYAnhsGfDOfaQv5TDMxpo+3fxlR0= Received: by 10.210.78.16 with SMTP id a16mr1008906ebb.1.1247845177596; Fri, 17 Jul 2009 08:39:37 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 7sm3560955eyb.55.2009.07.17.08.39.36 (version=SSLv3 cipher=RC4-MD5); Fri, 17 Jul 2009 08:39:37 -0700 (PDT) Message-ID: <4A609BAA.6090204@gmail.com> Date: Fri, 17 Jul 2009 17:41:30 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: mchehab@infradead.org, linux-media@vger.kernel.org, Andrew Morton Subject: [PATCH] media: strncpy does not null terminate string References: <4A607185.6020302@gmail.com> In-Reply-To: <4A607185.6020302@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org strlcpy() will always null terminate the string. Signed-off-by: Roel Kluin --- -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c index 326f760..cead089 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c @@ -19,7 +19,7 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d) return -EINVAL; } - strncpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name)); + strlcpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name)); d->i2c_adap.class = I2C_CLASS_TV_DIGITAL, d->i2c_adap.algo = d->props.i2c_algo; d->i2c_adap.algo_data = NULL; diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 2876ce0..bdb4ced 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -1033,7 +1033,7 @@ long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) if (std->index != 0) return -EINVAL; std->id = V4L2_STD_UNKNOWN; - strncpy(std->name, "webcam", sizeof(std->name)); + strlcpy(std->name, "webcam", sizeof(std->name)); return 0; } diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index 03dc2f3..9f43695 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c @@ -1169,7 +1169,7 @@ zoran_setup_videocodec (struct zoran *zr, m->type = 0; m->flags = CODEC_FLAG_ENCODER | CODEC_FLAG_DECODER; - strncpy(m->name, ZR_DEVNAME(zr), sizeof(m->name)); + strlcpy(m->name, ZR_DEVNAME(zr), sizeof(m->name)); m->data = zr; switch (type)