From 0c6bcfb345075dc042b139bcdfbc11cd862c7258 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 17 Apr 2026 12:05:20 -0400 Subject: Fix incorrect usage of maxlen argument in snprintf calls --- tests/test_utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/test_utils.c') diff --git a/tests/test_utils.c b/tests/test_utils.c index 79bca43..7361139 100644 --- a/tests/test_utils.c +++ b/tests/test_utils.c @@ -147,7 +147,9 @@ void test_xmkstemp() { char buf[100] = {0}; tempfp = fopen(tempfile, "r"); - fgets(buf, sizeof(buf) - 1, tempfp); + const char *line = fgets(buf, sizeof(buf) - 1, tempfp); + STASIS_ASSERT_FATAL(line != NULL, "file should contain data written earlier"); + STASIS_ASSERT(strcmp(line, buf) == 0, "file should contain the correct data"); fclose(tempfp); STASIS_ASSERT(strcmp(buf, data) == 0, "data written to temp file is incorrect"); -- cgit