[Piglit] [PATCH] crucible: Fix all format-security issues
Danylo Piliaiev
danylo.piliaiev at gmail.com
Wed Jul 25 12:02:23 UTC 2018
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107374
Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
---
src/framework/test/t_dump.c | 2 +-
src/framework/test/t_result.c | 6 +++---
src/tests/self/concurrent-output.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/framework/test/t_dump.c b/src/framework/test/t_dump.c
index 04f55c3..edfb3fa 100644
--- a/src/framework/test/t_dump.c
+++ b/src/framework/test/t_dump.c
@@ -71,7 +71,7 @@ t_dump_image_fv(cru_image_t *image, const char *format, va_list va)
return;
string_t filename = STRING_INIT;
- string_appendf(&filename, t_name);
+ string_append_cstr(&filename, t_name);
string_append_char(&filename, '.');
string_vappendf(&filename, format, va);
diff --git a/src/framework/test/t_result.c b/src/framework/test/t_result.c
index 80ab731..209d6b2 100644
--- a/src/framework/test/t_result.c
+++ b/src/framework/test/t_result.c
@@ -78,7 +78,7 @@ __t_skipfv(const char *file, int line, const char *format, va_list va)
string_vappendf(&s, format, va);
}
- logi(string_data(&s));
+ logi("%s", string_data(&s));
string_finish(&s);
__t_skip_silent();
@@ -127,7 +127,7 @@ __t_failfv(const char *file, int line, const char *format, va_list va)
string_vappendf(&s, format, va);
}
- loge(string_data(&s));
+ loge("%s", string_data(&s));
string_finish(&s);
__t_fail_silent();
@@ -179,7 +179,7 @@ __t_assertfv(const char *file, int line, bool cond, const char *cond_string,
string_t s = STRING_INIT;
string_appendf(&s, "%s:%d: ", file, line);
string_vappendf(&s, format, va);
- loge(string_data(&s));
+ loge("%s", string_data(&s));
string_finish(&s);
}
diff --git a/src/tests/self/concurrent-output.c b/src/tests/self/concurrent-output.c
index 002d4ed..4114af6 100644
--- a/src/tests/self/concurrent-output.c
+++ b/src/tests/self/concurrent-output.c
@@ -45,7 +45,7 @@ test_logi_a(void)
char *a = mk_big_str('a');
for (int i = 0; i < 1024; ++i) {
- logi(a);
+ logi("%s", a);
}
}
@@ -61,7 +61,7 @@ test_logi_b(void)
char *b = mk_big_str('b');
for (int i = 0; i < 1024; ++i) {
- logi(b);
+ logi("%s", b);
}
}
--
2.17.1
More information about the Piglit
mailing list