From 347677c3330ece8496b9cd242fd7e4292c2260ae Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 24 Apr 2026 15:55:21 -0400 Subject: NUL terminate after copy --- tests/test_utils.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/test_utils.c') diff --git a/tests/test_utils.c b/tests/test_utils.c index a5faf5c..4f89509 100644 --- a/tests/test_utils.c +++ b/tests/test_utils.c @@ -312,6 +312,7 @@ void test_path_dirname() { const char *expected = data[i + 1]; char tmp[PATH_MAX] = {0}; strncpy(tmp, input, sizeof(tmp) - 1); + tmp[sizeof(tmp) - 1] = '\0'; char *result = path_dirname(tmp); STASIS_ASSERT(strcmp(expected, result) == 0, NULL); -- cgit From 2596f879f9cc8a6eab4fd2991d9639ef22753b62 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 26 Apr 2026 01:15:38 -0400 Subject: test_fix_tox_conf: Check lines and result --- tests/test_utils.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/test_utils.c') diff --git a/tests/test_utils.c b/tests/test_utils.c index 4f89509..fd398e2 100644 --- a/tests/test_utils.c +++ b/tests/test_utils.c @@ -71,6 +71,8 @@ void test_fix_tox_conf() { } char **lines = file_readlines(result, 0, 0, NULL); + STASIS_ASSERT_FATAL(lines != NULL, "lines array should not be NULL"); + STASIS_ASSERT_FATAL(result != NULL, "result should not be NULL"); STASIS_ASSERT(strstr_array(lines, expected) != NULL, "{posargs} not found in result"); guard_array_free(lines); -- cgit