Re: [PATCH] usbvideo: limit the length of string creation

From: Laurent Pinchart
Date: Tue Dec 01 2009 - 06:32:11 EST


On Saturday 21 November 2009 18:02:56 NÃmeth MÃrton wrote:
> From: MÃrton NÃmeth <nm127@xxxxxxxxxxx>
>
> 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/)
>
> // <smpl>
> @@
> expression dev;
> expression phys;
> expression str;
> expression size;
> @@
> usb_make_path(dev, phys, size);
> - strncat(phys, str, size);
> + strlcat(phys, str, size);
> // </smpl>
>
> Signed-off-by: MÃrton NÃmeth <nm127@xxxxxxxxxxx>

Acked-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

--
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/