From 7fe41b6a8c82782cce2484e4697d34d18e947925 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sat, 21 Feb 2026 18:56:15 -0500 Subject: [PATCH 1/2] Apply suggested fix to tests/unit/test_memory.c from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/unit/test_memory.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/unit/test_memory.c b/tests/unit/test_memory.c index 80481f44..3bb7df2f 100644 --- a/tests/unit/test_memory.c +++ b/tests/unit/test_memory.c @@ -121,6 +121,9 @@ void test_safe_strcat_overflow_returns_error(void) { char buf[8] = "hello"; int rc = safe_strcat(buf, "_overflow", sizeof(buf)); TEST_ASSERT_NOT_EQUAL(0, rc); + /* Buffer should remain a valid, null-terminated string and keep its safe content */ + TEST_ASSERT_EQUAL_INT('\0', buf[sizeof(buf) - 1] == '\0' ? '\0' : buf[sizeof(buf) - 1]); + TEST_ASSERT_EQUAL_STRING_LEN("hello", buf, 5); } /* ================================================================ From 8856a4ed937965eed230a76cca09f1d507c1f34d Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sat, 21 Feb 2026 18:56:16 -0500 Subject: [PATCH 2/2] Apply suggested fix to tests/unit/test_memory.c from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/unit/test_memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/test_memory.c b/tests/unit/test_memory.c index 3bb7df2f..83ca75a0 100644 --- a/tests/unit/test_memory.c +++ b/tests/unit/test_memory.c @@ -99,6 +99,7 @@ void test_safe_strcpy_success(void) { void test_safe_strcpy_truncation_returns_error(void) { char buf[4]; + memset(buf, 0, sizeof(buf)); int rc = safe_strcpy(buf, "hello_world", sizeof(buf)); TEST_ASSERT_NOT_EQUAL(0, rc); /* buf should still be null-terminated and contain truncated data */