[Cocci] what's wrong with this SmPL?

Julia Lawall julia at diku.dk
Sat Nov 21 21:39:33 CET 2009


> @@
> expression buffer;
> expression field;
> expression size;
> expression str;
> @@
> 	memset(buffer, 0, size);
> 	...
> -	strncpy(
> +	strlcpy(
> 	buffer->field, str, sizeof(buffer->field)
> 	);

field is not an expression, since it in itself does not have a value.  It 
should be classified as an identifier.  Identifier should also be used if 
you are matching a variable declaration or the header of a function 
declaration.

julia


More information about the Cocci mailing list