summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile1
-rw-r--r--tests/test_strlen_static_read.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 81593cf..c862c52 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -87,6 +87,7 @@ RUNTIME_TARGETS= \
87 test_stpncpy_overwrite_over \ 87 test_stpncpy_overwrite_over \
88 test_stpncpy_overwrite_under \ 88 test_stpncpy_overwrite_under \
89 test_stpncpy_static_write \ 89 test_stpncpy_static_write \
90 test_strlen_static_read \
90 test_strcat_static_write \ 91 test_strcat_static_write \
91 test_strchr_dynamic_read \ 92 test_strchr_dynamic_read \
92 test_strchr_static_read \ 93 test_strchr_static_read \
diff --git a/tests/test_strlen_static_read.c b/tests/test_strlen_static_read.c
new file mode 100644
index 0000000..b1f928d
--- /dev/null
+++ b/tests/test_strlen_static_read.c
@@ -0,0 +1,22 @@
1#define _GNU_SOURCE
2#define _BSD_SOURCE
3
4#include "common.h"
5
6#include <string.h>
7
8int main(int argc, char** argv) {
9 char* canary1 = "ABCDEFGHIJKLMNOPQ";
10 char buf[] = {'a', 'b', 'c', 'd', '\0'};
11 char* canary2 = "ABCDEF";
12 strlen(buf);
13 puts(buf);
14 buf[4] = 'e';
15
16 CHK_FAIL_START
17 strlen(buf);
18 CHK_FAIL_END
19
20 puts(argv[1]);
21 return ret;
22}