From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753378AbZLALb6 (ORCPT ); Tue, 1 Dec 2009 06:31:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751793AbZLALb5 (ORCPT ); Tue, 1 Dec 2009 06:31:57 -0500 Received: from perceval.irobotique.be ([92.243.18.41]:54732 "EHLO perceval.irobotique.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751503AbZLALb4 convert rfc822-to-8bit (ORCPT ); Tue, 1 Dec 2009 06:31:56 -0500 From: Laurent Pinchart To: =?utf-8?q?N=C3=A9meth_M=C3=A1rton?= Subject: Re: [PATCH] usbvideo: limit the length of string creation Date: Tue, 1 Dec 2009 12:33:12 +0100 User-Agent: KMail/1.12.3 (Linux/2.6.31.1; KDE/4.3.3; x86_64; ; ) Cc: V4L Mailing List , cocci@diku.dk, LKML References: <4B081D40.9030607@freemail.hu> In-Reply-To: <4B081D40.9030607@freemail.hu> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 8BIT Message-Id: <200912011233.12290.laurent.pinchart@ideasonboard.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday 21 November 2009 18:02:56 Németh Márton wrote: > From: Márton Németh > > Use strlcat() to append a string to the previously created first part. > The strlcat() function limits the size of the string to the whole > destination buffer. > > The semantic match that finds this kind of problem is as follows: > (http://coccinelle.lip6.fr/) > > // > @@ > expression dev; > expression phys; > expression str; > expression size; > @@ > usb_make_path(dev, phys, size); > - strncat(phys, str, size); > + strlcat(phys, str, size); > // > > Signed-off-by: Márton Németh Acked-by: Laurent Pinchart -- Regards, Laurent Pinchart