[Piglit] [PATCH] util-cl: Fix GCC format-security warning.

Tom Stellard tom at stellard.net
Tue Jan 28 06:37:53 PST 2014


On Mon, Jan 27, 2014 at 08:07:15PM -0800, Vinson Lee wrote:
> This patch fixes this GCC warning.
> 
> piglit-framework-cl-program.c: In function ‘piglit_cl_program_test_run’:
> piglit-framework-cl-program.c:218:3: warning: format not a string literal and no format arguments [-Wformat-security]
>    sprintf(build_options+strlen(old), config->build_options);
>    ^
> 
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
> ---
>  tests/util/piglit-framework-cl-program.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/util/piglit-framework-cl-program.c b/tests/util/piglit-framework-cl-program.c
> index 417405d..374296f 100644
> --- a/tests/util/piglit-framework-cl-program.c
> +++ b/tests/util/piglit-framework-cl-program.c
> @@ -215,7 +215,7 @@ piglit_cl_program_test_run(const int argc,
>  		char* old = build_options;
>  		build_options = malloc((strlen(old) + strlen(config->build_options) + 1) * sizeof(char));
>  		strcpy(build_options, old);
> -		sprintf(build_options+strlen(old), config->build_options);
> +		sprintf(build_options+strlen(old), "%s", config->build_options);
>  		free(old);
>  	}
>  	if(version > 10) {
> -- 
> 1.8.3.2
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list