summaryrefslogtreecommitdiff
path: root/tests/test_strcpy_overwrite_over.c
diff options
context:
space:
mode:
authorjvoisin2023-05-30 20:46:14 +0200
committerjvoisin2023-05-30 20:46:14 +0200
commit1ace027335c9ca0ae400958aded936d04505ec86 (patch)
treecedfb24733bffe35d070688ef5baee94ce90d997 /tests/test_strcpy_overwrite_over.c
parentb40f6d87482f20e968b27470baca042e50cd6792 (diff)
Add a check for overlapping copies in strcpy
Diffstat (limited to 'tests/test_strcpy_overwrite_over.c')
-rw-r--r--tests/test_strcpy_overwrite_over.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_strcpy_overwrite_over.c b/tests/test_strcpy_overwrite_over.c
new file mode 100644
index 0000000..924b346
--- /dev/null
+++ b/tests/test_strcpy_overwrite_over.c
@@ -0,0 +1,15 @@
1#include "common.h"
2
3#include <string.h>
4
5int 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 strcpy(buffer+1, buffer);
11 CHK_FAIL_END
12
13 puts(buffer);
14 return ret;
15}