diff options
| author | jvoisin | 2023-06-22 18:07:41 +0200 |
|---|---|---|
| committer | jvoisin | 2023-06-22 18:07:41 +0200 |
| commit | 532f4bfd0ba906e5a1410b9d2a46cf8a4992f062 (patch) | |
| tree | 6d84f1e0f285c9aff10389904b4e5ad9e6b5c2ea /tests/test_stpncpy_overwrite_under.c | |
| parent | af7480d0190cb5dcf279a7ddfab320ff084a3471 (diff) | |
Add tests for stcncpy
Diffstat (limited to 'tests/test_stpncpy_overwrite_under.c')
| -rw-r--r-- | tests/test_stpncpy_overwrite_under.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_stpncpy_overwrite_under.c b/tests/test_stpncpy_overwrite_under.c new file mode 100644 index 0000000..5625ff8 --- /dev/null +++ b/tests/test_stpncpy_overwrite_under.c | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <string.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | char buffer[9] = {'A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', '\0'}; | ||
| 7 | puts(buffer); | ||
| 8 | |||
| 9 | CHK_FAIL_START | ||
| 10 | stpncpy(buffer-1, buffer, 5); | ||
| 11 | CHK_FAIL_END | ||
| 12 | |||
| 13 | puts(buffer); | ||
| 14 | return ret; | ||
| 15 | } | ||
