diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Makefile | 2 | ||||
| -rw-r--r-- | tests/test_strcpy_dynamic_write.c | 16 | ||||
| -rw-r--r-- | tests/test_strncat_dynamic_write.c | 16 |
3 files changed, 34 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile index b702e2e..3a57eb5 100644 --- a/tests/Makefile +++ b/tests/Makefile | |||
| @@ -88,7 +88,9 @@ TARGETS= \ | |||
| 88 | test_strcpy_overwrite_over \ | 88 | test_strcpy_overwrite_over \ |
| 89 | test_strcpy_overwrite_under \ | 89 | test_strcpy_overwrite_under \ |
| 90 | test_strcpy_static_write \ | 90 | test_strcpy_static_write \ |
| 91 | test_strcpy_dynamic_write \ | ||
| 91 | test_strncat_static_write \ | 92 | test_strncat_static_write \ |
| 93 | test_strncat_dynamic_write \ | ||
| 92 | test_strncpy_overwrite_over \ | 94 | test_strncpy_overwrite_over \ |
| 93 | test_strncpy_overwrite_under \ | 95 | test_strncpy_overwrite_under \ |
| 94 | test_strncpy_static_write \ | 96 | test_strncpy_static_write \ |
diff --git a/tests/test_strcpy_dynamic_write.c b/tests/test_strcpy_dynamic_write.c new file mode 100644 index 0000000..d50749b --- /dev/null +++ b/tests/test_strcpy_dynamic_write.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <string.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | char buffer[8] = {0}; | ||
| 7 | strcpy(buffer, "1234567"); | ||
| 8 | puts(buffer); | ||
| 9 | |||
| 10 | CHK_FAIL_START | ||
| 11 | strcpy(buffer, argv[1]); | ||
| 12 | CHK_FAIL_END | ||
| 13 | |||
| 14 | puts(buffer); | ||
| 15 | return ret; | ||
| 16 | } | ||
diff --git a/tests/test_strncat_dynamic_write.c b/tests/test_strncat_dynamic_write.c new file mode 100644 index 0000000..c538339 --- /dev/null +++ b/tests/test_strncat_dynamic_write.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #include "common.h" | ||
| 2 | |||
| 3 | #include <string.h> | ||
| 4 | |||
| 5 | int main(int argc, char** argv) { | ||
| 6 | char buffer[8] = {0}; | ||
| 7 | strncat(buffer, "1234567", 5); | ||
| 8 | puts(buffer); | ||
| 9 | |||
| 10 | CHK_FAIL_START | ||
| 11 | strncat(buffer, argv[1], argc); | ||
| 12 | CHK_FAIL_END | ||
| 13 | |||
| 14 | puts(buffer); | ||
| 15 | return ret; | ||
| 16 | } | ||
