From 5c1f18bf3a98ad71d3674f4fd935feae73e0963a Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sat, 3 Jan 2026 02:01:22 -0500 Subject: Trying to fix a buffer overflow reported by the CI * Locally ASAN wasn't complaining. --- tests/test_multiprocessing.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_multiprocessing.c b/tests/test_multiprocessing.c index 4a68688..1db8716 100644 --- a/tests/test_multiprocessing.c +++ b/tests/test_multiprocessing.c @@ -185,7 +185,7 @@ static void test_mp_timeout() { } static void test_mp_seconds_to_human_readable() { - struct testcase { + const struct testcase { int seconds; const char *expected; } tc[] = { @@ -201,7 +201,8 @@ static void test_mp_seconds_to_human_readable() { {.seconds = 86400, "24h 0m 0s"}, }; for (size_t i = 0; i < sizeof(tc) / sizeof(tc[0]); i++) { - char *result = seconds_to_human_readable(tc[i].seconds); + char result[255] = {0}; + seconds_to_human_readable(tc[i].seconds, result, sizeof(result)); printf("seconds=%d, expected: %s, got: %s\n", tc[i].seconds, tc[i].expected, result); STASIS_ASSERT(strcmp(result, tc[i].expected) == 0, "bad output"); } -- cgit