diff options
| author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2026-04-28 11:45:10 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-28 11:45:10 -0400 |
| commit | 10f13b36560c5112554c54d8958081b7aa518050 (patch) | |
| tree | bd27866c4352de38ebc5b13f8208768d576ae904 /tests/test_relocation.c | |
| parent | 017bc273aedf3f20512beeb78a2f513913e56305 (diff) | |
| parent | d761cc976a8d645e61d23f6e43dcfec1a7fdb061 (diff) | |
| download | stasis-10f13b36560c5112554c54d8958081b7aa518050.tar.gz | |
Merge pull request #137 from jhunkeler/bughunt-1001
Bug Hunt 0x1001
Diffstat (limited to 'tests/test_relocation.c')
| -rw-r--r-- | tests/test_relocation.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/test_relocation.c b/tests/test_relocation.c index 69142dc..4a02e01 100644 --- a/tests/test_relocation.c +++ b/tests/test_relocation.c @@ -15,6 +15,7 @@ void test_replace_text() { const char *expected = targets[i + 1]; char input[BUFSIZ] = {0}; strncpy(input, test_string, sizeof(input) - 1); + input[sizeof(input) - 1] = '\0'; printf("input: %s\n", input); printf("target: %s\n", target); @@ -39,6 +40,7 @@ void test_file_replace_text() { STASIS_ASSERT(file_replace_text(filename, target, "^^^", 0) == 0, "string replacement failed"); } else { STASIS_ASSERT(false, "failed to open file for writing"); + fclose(fp); return; } @@ -47,8 +49,10 @@ void test_file_replace_text() { if (fp) { fread(input, sizeof(*input), sizeof(input), fp); STASIS_ASSERT(strcmp(input, expected) == 0, "unexpected replacement"); + fclose(fp); } else { STASIS_ASSERT(false, "failed to open file for reading"); + fclose(fp); return; } } |
