diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-01-03 02:01:22 -0500 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-01-03 02:03:01 -0500 |
| commit | 5c1f18bf3a98ad71d3674f4fd935feae73e0963a (patch) | |
| tree | 71cf57118aefc277e44122b7ffb96698db4694a5 /tests | |
| parent | 11e4e32a37e61d7e3168adbdfaf507aa58cb43f0 (diff) | |
| download | stasis-5c1f18bf3a98ad71d3674f4fd935feae73e0963a.tar.gz | |
Trying to fix a buffer overflow reported by the CI
* Locally ASAN wasn't complaining.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_multiprocessing.c | 5 |
1 files changed, 3 insertions, 2 deletions
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"); } |
