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

Vinson Lee vlee at freedesktop.org
Mon Jan 27 20:07:15 PST 2014


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>
---
 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



More information about the Piglit mailing list