summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile142
-rw-r--r--tests/common.h66
-rw-r--r--tests/test_FD_CLR_SETSIZE.c14
-rw-r--r--tests/test_FD_CLR_negative.c14
-rw-r--r--tests/test_FD_SET_SETSIZE.c14
-rw-r--r--tests/test_FD_SET_negative.c14
-rw-r--r--tests/test_bcopy_dynamic_read.c18
-rw-r--r--tests/test_bcopy_dynamic_write.c18
-rw-r--r--tests/test_bcopy_static_read.c18
-rw-r--r--tests/test_bcopy_static_write.c18
-rw-r--r--tests/test_bzero_dynamic_write.c18
-rw-r--r--tests/test_bzero_static_write.c18
-rw-r--r--tests/test_compile.c18
-rw-r--r--tests/test_compile.cc18
-rw-r--r--tests/test_confstr_dynamic.c16
-rw-r--r--tests/test_fgets_dynamic.c15
-rw-r--r--tests/test_fgets_static.c15
-rw-r--r--tests/test_fgetws_dynamic.c15
-rw-r--r--tests/test_fgetws_static.c15
-rw-r--r--tests/test_fread_int_overflow.c14
-rw-r--r--tests/test_fread_overwrite_dynamic.c17
-rw-r--r--tests/test_fread_overwrite_static.c17
-rw-r--r--tests/test_fwrite_int_overflow.c14
-rw-r--r--tests/test_fwrite_overwrite_dynamic.c17
-rw-r--r--tests/test_fwrite_overwrite_static.c17
-rw-r--r--tests/test_getcwd_dynamic.c16
-rw-r--r--tests/test_getcwd_static.c16
-rw-r--r--tests/test_getdomainname_dynamic.c19
-rw-r--r--tests/test_getdomainname_static.c19
-rw-r--r--tests/test_getgroups_dynamic.c16
-rw-r--r--tests/test_getgroups_static.c16
-rw-r--r--tests/test_gethostname_dynamic.c16
-rw-r--r--tests/test_gethostname_static.c16
-rw-r--r--tests/test_getlogin_r_dynamic.c19
-rw-r--r--tests/test_getlogin_r_static.c19
-rw-r--r--tests/test_memcpy_dynamic_read.c16
-rw-r--r--tests/test_memcpy_dynamic_write.c16
-rw-r--r--tests/test_memcpy_static_read.c16
-rw-r--r--tests/test_memcpy_static_write.c16
-rw-r--r--tests/test_memmove_dynamic_read.c16
-rw-r--r--tests/test_memmove_dynamic_write.c16
-rw-r--r--tests/test_memmove_static_read.c16
-rw-r--r--tests/test_memmove_static_write.c16
-rw-r--r--tests/test_mempcpy_dynamic_read.c19
-rw-r--r--tests/test_mempcpy_dynamic_write.c19
-rw-r--r--tests/test_mempcpy_static_read.c19
-rw-r--r--tests/test_mempcpy_static_write.c19
-rw-r--r--tests/test_memset_dynamic_write.c16
-rw-r--r--tests/test_memset_static_write.c16
-rw-r--r--tests/test_poll_dynamic.c14
-rw-r--r--tests/test_poll_static.c14
-rw-r--r--tests/test_ppoll_dynamic.c17
-rw-r--r--tests/test_ppoll_static.c17
-rw-r--r--tests/test_read_dynamic.c14
-rw-r--r--tests/test_read_static.c15
-rw-r--r--tests/test_readlink_dynamic.c16
-rw-r--r--tests/test_readlink_static.c16
-rw-r--r--tests/test_recv_dynamic.c14
-rw-r--r--tests/test_recv_static.c14
-rw-r--r--tests/test_recvfrom_dynamic.c14
-rw-r--r--tests/test_recvfrom_static.c14
-rw-r--r--tests/test_select_dynamic.c16
-rw-r--r--tests/test_select_static.c16
-rw-r--r--tests/test_send_dynamic.c14
-rw-r--r--tests/test_send_static.c14
-rw-r--r--tests/test_sendto_dynamic.c14
-rw-r--r--tests/test_sendto_static.c14
-rw-r--r--tests/test_sprintf.c9
-rw-r--r--tests/test_sprintf_62.c21
-rw-r--r--tests/test_stpcpy_dynamic_write.c16
-rw-r--r--tests/test_stpcpy_static_write.c16
-rw-r--r--tests/test_stpncpy_dynamic_write.c17
-rw-r--r--tests/test_stpncpy_static_write.c16
-rw-r--r--tests/test_strcat_static_write.c16
-rw-r--r--tests/test_strcpy_dynamic_write.c16
-rw-r--r--tests/test_strcpy_static_write.c16
-rw-r--r--tests/test_strlcat_dynamic_write.c21
-rw-r--r--tests/test_strlcat_static_write.c21
-rw-r--r--tests/test_strlcpy_dynamic_write.c21
-rw-r--r--tests/test_strlcpy_static_write.c21
-rw-r--r--tests/test_strncat_dynamic_write.c18
-rw-r--r--tests/test_strncat_static_write.c19
-rw-r--r--tests/test_strncpy_dynamic_write.c18
-rw-r--r--tests/test_strncpy_static_write.c18
-rw-r--r--tests/test_swab_dynamic_read.c16
-rw-r--r--tests/test_swab_dynamic_write.c16
-rw-r--r--tests/test_swab_static_read.c16
-rw-r--r--tests/test_swab_static_write.c16
-rw-r--r--tests/test_ttyname_r_dynamic.c14
-rw-r--r--tests/test_ttyname_r_static.c14
-rw-r--r--tests/test_vsnprintf_dynamic.c29
-rw-r--r--tests/test_vsnprintf_static.c29
-rw-r--r--tests/test_vsprintf.c29
-rw-r--r--tests/test_wcscat_static_write.c16
-rw-r--r--tests/test_wcscpy_static_write.c16
-rw-r--r--tests/test_wcsncat_static_write.c16
-rw-r--r--tests/test_wcsncpy_static_write.c16
-rw-r--r--tests/test_wmemcpy_dynamic_write.c16
-rw-r--r--tests/test_wmemcpy_static_write.c16
-rw-r--r--tests/test_wmemmove_dynamic_write.c16
-rw-r--r--tests/test_wmemmove_static_write.c16
-rw-r--r--tests/test_wmemset_dynamic.c16
-rw-r--r--tests/test_wmemset_static.c16
-rw-r--r--tests/test_write_dynamic.c14
-rw-r--r--tests/test_write_static.c15
105 files changed, 1923 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..b71c004
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,142 @@
1MACHINE := $(shell uname -m)
2CFLAGS ?= -std=gnu99
3CFLAGS += -I../include/ -D_FORTIFY_SOURCE=3 -static -O2 -Wall -Wextra -Werror -Werror=pointer-arith
4CFLAGS += -Wno-format -Wno-array-bounds -Wno-shift-count-negative -Wno-unused-variable -Wno-unused-parameter
5
6RUNTIME_TARGETS= \
7 test_FD_CLR_SETSIZE \
8 test_FD_CLR_negative \
9 test_FD_SET_SETSIZE \
10 test_FD_SET_negative \
11 test_bcopy_dynamic_read \
12 test_bcopy_dynamic_write \
13 test_bcopy_static_read \
14 test_bcopy_static_write \
15 test_bzero_dynamic_write \
16 test_bzero_static_write \
17 test_compile \
18 test_confstr_dynamic \
19 test_fgets_dynamic \
20 test_fgets_static \
21 test_fgetws_dynamic \
22 test_fgetws_static \
23 test_fread_int_overflow \
24 test_fread_overwrite_dynamic \
25 test_fread_overwrite_static \
26 test_fwrite_int_overflow \
27 test_fwrite_overwrite_dynamic \
28 test_fwrite_overwrite_static \
29 test_getcwd_dynamic \
30 test_getcwd_static \
31 test_getdomainname_dynamic \
32 test_getdomainname_static \
33 test_getgroups_dynamic \
34 test_getgroups_static \
35 test_gethostname_dynamic \
36 test_gethostname_static \
37 test_getlogin_r_dynamic \
38 test_getlogin_r_static \
39 test_memcpy_dynamic_read \
40 test_memcpy_dynamic_write \
41 test_memcpy_static_read \
42 test_memmove_dynamic_read \
43 test_memmove_dynamic_write \
44 test_memmove_static_read \
45 test_memmove_static_write \
46 test_mempcpy_dynamic_read \
47 test_mempcpy_dynamic_write \
48 test_mempcpy_static_read \
49 test_mempcpy_static_write \
50 test_memset_dynamic_write \
51 test_memset_static_write \
52 test_poll_dynamic \
53 test_poll_static \
54 test_ppoll_dynamic \
55 test_ppoll_static \
56 test_read_dynamic \
57 test_read_static \
58 test_readlink_dynamic \
59 test_readlink_static \
60 test_recv_dynamic \
61 test_recv_static \
62 test_recvfrom_dynamic \
63 test_recvfrom_static \
64 test_send_dynamic \
65 test_send_static \
66 test_sendto_dynamic \
67 test_sendto_static \
68 test_sprintf \
69 test_sprintf_62 \
70 test_stpcpy_dynamic_write \
71 test_stpcpy_static_write \
72 test_stpncpy_dynamic_write \
73 test_stpncpy_static_write \
74 test_strcat_static_write \
75 test_strcpy_dynamic_write \
76 test_strcpy_static_write \
77 test_strlcat_dynamic_write \
78 test_strlcat_static_write \
79 test_strlcpy_dynamic_write \
80 test_strlcpy_static_write \
81 test_strncat_dynamic_write \
82 test_strncat_static_write \
83 test_strncpy_dynamic_write \
84 test_strncpy_static_write \
85 test_swab_dynamic_read \
86 test_swab_dynamic_write \
87 test_swab_static_read \
88 test_ttyname_r_dynamic \
89 test_ttyname_r_static \
90 test_vsnprintf_dynamic \
91 test_vsnprintf_static \
92 test_vsprintf \
93 test_wcscat_static_write \
94 test_wcscpy_static_write \
95 test_wcsncat_static_write \
96 test_wcsncpy_static_write \
97 test_wmemcpy_dynamic_write \
98 test_wmemcpy_static_write \
99 test_wmemmove_dynamic_write \
100 test_wmemmove_static_write \
101 test_wmemset_dynamic \
102 test_wmemset_static \
103 test_write_dynamic \
104 test_write_static \
105
106gcc: CC=../$(MACHINE)-linux-musl-native/bin/gcc
107gcc: CFLAGS += -Wno-stringop-overread -Wno-stringop-overflow -ffreestanding
108gcc: $(RUNTIME_TARGETS)
109
110clang: CC=clang
111clang: CFLAGS+=-I/usr/include/$(MACHINE)-linux-musl
112clang: CFLAGS+=-I../$(MACHINE)-linux-musl-native/include/
113clang: CFLAGS+=-I$(MACHINE)-linux-musl-native/include/
114clang: CFLAGS+=-nostdinc
115clang: CXX=clang++
116clang: CXXFLAGS+=-I/usr/include/$(MACHINE)-linux-musl
117clang: CXXFLAGS+=-I../$(MACHINE)-linux-musl-native/include/
118clang: CXXFLAGS+=-I$(MACHINE)-linux-musl-native/include/
119clang: CXXFLAGS+=-nostdinc
120clang: $(RUNTIME_TARGETS) cpp
121
122all: gcc
123
124
125$(RUNTIME_TARGETS): %: %.c
126 $(CC) $(CFLAGS) -o $@ $<
127
128cpp: test_compile.cc
129 $(CXX) $(CXXFLAGS) test_compile.cc -o ./test_compile_cc
130 timeout 1s ./test_compile_cc 1234567890 2 3 4 5 6 7 8 9 0 >/dev/null && echo "$(EXE) OK" || echo "$(EXE) FAIL"; \
131
132run: $(RUNTIME_TARGETS)
133 $(foreach EXE, $(RUNTIME_TARGETS), \
134 timeout 1s ./$(EXE) 1234567890 2 3 4 5 6 7 8 9 0 >/dev/null && echo "$(EXE) OK" || echo "$(EXE) FAIL"; \
135 )
136
137clean:
138 $(foreach EXE, $(RUNTIME_TARGETS), \
139 rm -f ./$(EXE) \
140 )
141 rm -f ./test_compile_cc
142
diff --git a/tests/common.h b/tests/common.h
new file mode 100644
index 0000000..9567653
--- /dev/null
+++ b/tests/common.h
@@ -0,0 +1,66 @@
1/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
2 This snippet is taken from debug/tst-chk1 in the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#define _POSIX_C_SOURCE 2
19#define _XOPEN_SOURCE 700
20
21#include <setjmp.h>
22#include <unistd.h>
23#include <signal.h>
24#include <stdio.h>
25
26volatile int chk_fail_ok;
27volatile int ret;
28jmp_buf chk_fail_buf;
29
30static void
31handler (int sig)
32{
33 if (chk_fail_ok)
34 {
35 chk_fail_ok = 0;
36 longjmp (chk_fail_buf, 1);
37 }
38 else
39 _exit (127);
40}
41
42void
43__attribute__((constructor))
44set_fortify_handler (void)
45{
46 struct sigaction sa;
47
48 sa.sa_handler = handler;
49 sa.sa_flags = 0;
50 sigemptyset (&sa.sa_mask);
51
52 sigaction (SIGILL, &sa, NULL);
53 sigaction (SIGTRAP, &sa, NULL);
54}
55
56#define FAIL() \
57 do { fprintf (stderr, "Failure in %s:%d\n", __FILE__, __LINE__); ret = 1; } while (0)
58#define CHK_FAIL_START \
59 chk_fail_ok = 1; \
60 if (! setjmp (chk_fail_buf)) \
61 {
62#define CHK_FAIL_END \
63 chk_fail_ok = 0; \
64 FAIL (); \
65 }
66
diff --git a/tests/test_FD_CLR_SETSIZE.c b/tests/test_FD_CLR_SETSIZE.c
new file mode 100644
index 0000000..cd571f1
--- /dev/null
+++ b/tests/test_FD_CLR_SETSIZE.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/select.h>
4
5int main(int argc, char** argv) {
6 fd_set rfds;
7
8 CHK_FAIL_START
9 FD_CLR(FD_SETSIZE, &rfds);
10 CHK_FAIL_END
11
12 puts((const char*)&rfds);
13 return ret;
14}
diff --git a/tests/test_FD_CLR_negative.c b/tests/test_FD_CLR_negative.c
new file mode 100644
index 0000000..43b5e42
--- /dev/null
+++ b/tests/test_FD_CLR_negative.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/select.h>
4
5int main(int argc, char** argv) {
6 fd_set rfds;
7
8 CHK_FAIL_START
9 FD_CLR(-1, &rfds);
10 CHK_FAIL_END
11
12 puts((const char*)&rfds);
13 return ret;
14}
diff --git a/tests/test_FD_SET_SETSIZE.c b/tests/test_FD_SET_SETSIZE.c
new file mode 100644
index 0000000..87e197e
--- /dev/null
+++ b/tests/test_FD_SET_SETSIZE.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/select.h>
4
5int main(int argc, char** argv) {
6 fd_set rfds;
7
8 CHK_FAIL_START
9 FD_SET(FD_SETSIZE, &rfds);
10 CHK_FAIL_END
11
12 puts((const char*)&rfds);
13 return ret;
14}
diff --git a/tests/test_FD_SET_negative.c b/tests/test_FD_SET_negative.c
new file mode 100644
index 0000000..df0aa0c
--- /dev/null
+++ b/tests/test_FD_SET_negative.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/select.h>
4
5int main(int argc, char** argv) {
6 fd_set rfds;
7
8 CHK_FAIL_START
9 FD_SET(-1, &rfds);
10 CHK_FAIL_END
11
12 puts((const char*)&rfds);
13 return ret;
14}
diff --git a/tests/test_bcopy_dynamic_read.c b/tests/test_bcopy_dynamic_read.c
new file mode 100644
index 0000000..5455ddb
--- /dev/null
+++ b/tests/test_bcopy_dynamic_read.c
@@ -0,0 +1,18 @@
1#define _GNU_SOURCE
2
3#include "common.h"
4
5#include <strings.h>
6
7int main(int argc, char** argv) {
8 char buffer[12] = {0};
9 bcopy("1234567890", buffer, sizeof(buffer) - 1);
10 puts(buffer);
11
12 CHK_FAIL_START
13 bcopy("123456", buffer, argc);
14 CHK_FAIL_END
15
16 puts(buffer);
17 return ret;
18}
diff --git a/tests/test_bcopy_dynamic_write.c b/tests/test_bcopy_dynamic_write.c
new file mode 100644
index 0000000..1f0fa9b
--- /dev/null
+++ b/tests/test_bcopy_dynamic_write.c
@@ -0,0 +1,18 @@
1#define _GNU_SOURCE
2
3#include "common.h"
4
5#include <string.h>
6
7int main(int argc, char** argv) {
8 char buffer[8] = {0};
9 bcopy("1234567890", buffer, sizeof(buffer) - 1);
10 puts(buffer);
11
12 CHK_FAIL_START
13 bcopy("1234567890", buffer, argc);
14 CHK_FAIL_END
15
16 puts(buffer);
17 return ret;
18}
diff --git a/tests/test_bcopy_static_read.c b/tests/test_bcopy_static_read.c
new file mode 100644
index 0000000..e7a3c74
--- /dev/null
+++ b/tests/test_bcopy_static_read.c
@@ -0,0 +1,18 @@
1#define _GNU_SOURCE
2
3#include "common.h"
4
5#include <string.h>
6
7int main(int argc, char** argv) {
8 char buffer[8] = {0};
9 bcopy("123456", buffer, 4);
10 puts(buffer);
11
12 CHK_FAIL_START
13 bcopy("123456", buffer, sizeof(buffer));
14 CHK_FAIL_END
15
16 puts(buffer);
17 return ret;
18}
diff --git a/tests/test_bcopy_static_write.c b/tests/test_bcopy_static_write.c
new file mode 100644
index 0000000..47e737a
--- /dev/null
+++ b/tests/test_bcopy_static_write.c
@@ -0,0 +1,18 @@
1#define _GNU_SOURCE
2
3#include "common.h"
4
5#include <string.h>
6
7int main(int argc, char** argv) {
8 char buffer[8] = {0};
9 bcopy("1234567890", buffer, sizeof(buffer) - 1);
10 puts(buffer);
11
12 CHK_FAIL_START
13 bcopy("1234567890", buffer, sizeof(buffer) + 1);
14 CHK_FAIL_END
15
16 puts(buffer);
17 return ret;
18}
diff --git a/tests/test_bzero_dynamic_write.c b/tests/test_bzero_dynamic_write.c
new file mode 100644
index 0000000..6e68d46
--- /dev/null
+++ b/tests/test_bzero_dynamic_write.c
@@ -0,0 +1,18 @@
1#define _GNU_SOURCE
2
3#include "common.h"
4
5#include <strings.h>
6
7int main(int argc, char** argv) {
8 char buffer[8] = {0};
9 bzero(buffer, sizeof(buffer) - 1);
10 puts(buffer);
11
12 CHK_FAIL_START
13 bzero(buffer, argc);
14 CHK_FAIL_END
15
16 puts(buffer);
17 return ret;
18}
diff --git a/tests/test_bzero_static_write.c b/tests/test_bzero_static_write.c
new file mode 100644
index 0000000..59bfc83
--- /dev/null
+++ b/tests/test_bzero_static_write.c
@@ -0,0 +1,18 @@
1#define _GNU_SOURCE
2
3#include "common.h"
4
5#include <strings.h>
6
7int main(int argc, char** argv) {
8 char buffer[8] = {0};
9 bzero(buffer, sizeof(buffer) - 1);
10 puts(buffer);
11
12 CHK_FAIL_START
13 bzero(buffer, sizeof(buffer) + 1);
14 CHK_FAIL_END
15
16 puts(buffer);
17 return ret;
18}
diff --git a/tests/test_compile.c b/tests/test_compile.c
new file mode 100644
index 0000000..b794306
--- /dev/null
+++ b/tests/test_compile.c
@@ -0,0 +1,18 @@
1#include "common.h"
2
3#include <poll.h>
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7#include <strings.h>
8#include <unistd.h>
9#include <wchar.h>
10
11#include <sys/select.h>
12#include <sys/socket.h>
13#include <sys/stat.h>
14
15/* Check that all headers are compiling.*/
16int main(int argc, char** argv) {
17 return 0;
18}
diff --git a/tests/test_compile.cc b/tests/test_compile.cc
new file mode 100644
index 0000000..edbbb27
--- /dev/null
+++ b/tests/test_compile.cc
@@ -0,0 +1,18 @@
1#include "common.h"
2
3#include <poll.h>
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7#include <strings.h>
8#include <unistd.h>
9#include <wchar.h>
10
11#include <sys/select.h>
12#include <sys/socket.h>
13#include <sys/stat.h>
14
15// Check that all headers are compiling.
16int main(int argc, char** argv) {
17 return 0;
18}
diff --git a/tests/test_confstr_dynamic.c b/tests/test_confstr_dynamic.c
new file mode 100644
index 0000000..e5721e5
--- /dev/null
+++ b/tests/test_confstr_dynamic.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 confstr(_CS_PATH, buffer, 6);
9
10 CHK_FAIL_START
11 confstr(_CS_PATH, buffer, argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_fgets_dynamic.c b/tests/test_fgets_dynamic.c
new file mode 100644
index 0000000..751ca79
--- /dev/null
+++ b/tests/test_fgets_dynamic.c
@@ -0,0 +1,15 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <poll.h>
5
6int main(int argc, char** argv) {
7 char buffer[8] = {0};
8
9 CHK_FAIL_START
10 (void)fgets(buffer, argc, NULL);
11 CHK_FAIL_END
12
13 puts(buffer);
14 return ret;
15}
diff --git a/tests/test_fgets_static.c b/tests/test_fgets_static.c
new file mode 100644
index 0000000..7597e15
--- /dev/null
+++ b/tests/test_fgets_static.c
@@ -0,0 +1,15 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <poll.h>
5
6int main(int argc, char** argv) {
7 char buffer[12] = {0};
8
9 CHK_FAIL_START
10 (void)fgets(buffer, 14, NULL);
11 CHK_FAIL_END
12
13 puts(buffer);
14 return ret;
15}
diff --git a/tests/test_fgetws_dynamic.c b/tests/test_fgetws_dynamic.c
new file mode 100644
index 0000000..b9700e3
--- /dev/null
+++ b/tests/test_fgetws_dynamic.c
@@ -0,0 +1,15 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <wchar.h>
5
6int main(int argc, char** argv) {
7 wchar_t buffer[8] = {L'A'};
8
9 CHK_FAIL_START
10 fgetws(buffer, argc, NULL);
11 CHK_FAIL_END
12
13 printf("%ls\n", buffer);
14 return ret;
15}
diff --git a/tests/test_fgetws_static.c b/tests/test_fgetws_static.c
new file mode 100644
index 0000000..361d4f4
--- /dev/null
+++ b/tests/test_fgetws_static.c
@@ -0,0 +1,15 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <wchar.h>
5
6int main(int argc, char** argv) {
7 wchar_t buffer[12] = {L'A'};
8
9 CHK_FAIL_START
10 fgetws(buffer, 14, NULL);
11 CHK_FAIL_END
12
13 printf("%ls\n", buffer);
14 return ret;
15}
diff --git a/tests/test_fread_int_overflow.c b/tests/test_fread_int_overflow.c
new file mode 100644
index 0000000..d261815
--- /dev/null
+++ b/tests/test_fread_int_overflow.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <stdio.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8 CHK_FAIL_START
9 fread(buffer, (size_t)-1, (size_t)-1, stdin);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_fread_overwrite_dynamic.c b/tests/test_fread_overwrite_dynamic.c
new file mode 100644
index 0000000..b108dc5
--- /dev/null
+++ b/tests/test_fread_overwrite_dynamic.c
@@ -0,0 +1,17 @@
1#include "common.h"
2
3#include <assert.h>
4#include <stdio.h>
5
6int main(int argc, char** argv) {
7 char buffer[12] = {0};
8
9 assert((sizeof(buffer) - 2) * argc > sizeof(*buffer));
10
11 CHK_FAIL_START
12 fread(buffer, sizeof(buffer) - 2, argc, NULL);
13 CHK_FAIL_END
14
15 puts(buffer);
16 return ret;
17}
diff --git a/tests/test_fread_overwrite_static.c b/tests/test_fread_overwrite_static.c
new file mode 100644
index 0000000..b9b535e
--- /dev/null
+++ b/tests/test_fread_overwrite_static.c
@@ -0,0 +1,17 @@
1#include "common.h"
2
3#include <assert.h>
4#include <stdio.h>
5
6int main(int argc, char** argv) {
7 char buffer[12] = {0};
8
9 assert((sizeof(buffer) - 2) * 10 > sizeof(buffer));
10
11 CHK_FAIL_START
12 fread(buffer, sizeof(buffer) - 2, 10, stdin);
13 CHK_FAIL_END
14
15 puts(buffer);
16 return ret;
17}
diff --git a/tests/test_fwrite_int_overflow.c b/tests/test_fwrite_int_overflow.c
new file mode 100644
index 0000000..ccdeba2
--- /dev/null
+++ b/tests/test_fwrite_int_overflow.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <stdio.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8 CHK_FAIL_START
9 fwrite(buffer, (size_t)-1, (size_t)-1, stdin);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_fwrite_overwrite_dynamic.c b/tests/test_fwrite_overwrite_dynamic.c
new file mode 100644
index 0000000..fa249bd
--- /dev/null
+++ b/tests/test_fwrite_overwrite_dynamic.c
@@ -0,0 +1,17 @@
1#include "common.h"
2
3#include <assert.h>
4#include <stdio.h>
5
6int main(int argc, char** argv) {
7 char buffer[12] = {0};
8
9 assert((sizeof(buffer) - 2) * argc > sizeof(buffer));
10
11 CHK_FAIL_START
12 fwrite(buffer, sizeof(buffer) - 2, argc, stdin);
13 CHK_FAIL_END
14
15 puts(buffer);
16 return ret;
17}
diff --git a/tests/test_fwrite_overwrite_static.c b/tests/test_fwrite_overwrite_static.c
new file mode 100644
index 0000000..445b30d
--- /dev/null
+++ b/tests/test_fwrite_overwrite_static.c
@@ -0,0 +1,17 @@
1#include "common.h"
2
3#include <assert.h>
4#include <stdio.h>
5
6int main(int argc, char** argv) {
7 char buffer[12] = {0};
8
9 assert((sizeof(buffer) - 2) * 10 > sizeof(buffer));
10
11 CHK_FAIL_START
12 fwrite(buffer, sizeof(buffer) - 2, 10, stdin);
13 CHK_FAIL_END
14
15 puts(buffer);
16 return ret;
17}
diff --git a/tests/test_getcwd_dynamic.c b/tests/test_getcwd_dynamic.c
new file mode 100644
index 0000000..dc8dd94
--- /dev/null
+++ b/tests/test_getcwd_dynamic.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 getcwd(buffer, 6);
9
10 CHK_FAIL_START
11 getcwd(buffer, argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_getcwd_static.c b/tests/test_getcwd_static.c
new file mode 100644
index 0000000..61345f7
--- /dev/null
+++ b/tests/test_getcwd_static.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8 getcwd(buffer, 10);
9
10 CHK_FAIL_START
11 getcwd(buffer, 14);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_getdomainname_dynamic.c b/tests/test_getdomainname_dynamic.c
new file mode 100644
index 0000000..3c15b8e
--- /dev/null
+++ b/tests/test_getdomainname_dynamic.c
@@ -0,0 +1,19 @@
1#define _GNU_SOURCE
2#define _DEFAULT_SOURCE
3
4#include "common.h"
5
6#include <unistd.h>
7
8int main(int argc, char** argv) {
9 char buffer[8] = {0};
10
11 getdomainname(buffer, 6);
12
13 CHK_FAIL_START
14 getdomainname(buffer, argc);
15 CHK_FAIL_END
16
17 puts(buffer);
18 return ret;
19}
diff --git a/tests/test_getdomainname_static.c b/tests/test_getdomainname_static.c
new file mode 100644
index 0000000..478a274
--- /dev/null
+++ b/tests/test_getdomainname_static.c
@@ -0,0 +1,19 @@
1#define _GNU_SOURCE
2#define _DEFAULT_SOURCE
3
4#include "common.h"
5
6#include <unistd.h>
7
8int main(int argc, char** argv) {
9 char buffer[12] = {0};
10
11 getdomainname(buffer, 10);
12
13 CHK_FAIL_START
14 getdomainname(buffer, 14);
15 CHK_FAIL_END
16
17 puts(buffer);
18 return ret;
19}
diff --git a/tests/test_getgroups_dynamic.c b/tests/test_getgroups_dynamic.c
new file mode 100644
index 0000000..6d35381
--- /dev/null
+++ b/tests/test_getgroups_dynamic.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 gid_t list[8] = {0};
7
8 getgroups(6, list);
9
10 CHK_FAIL_START
11 getgroups(argc, list);
12 CHK_FAIL_END
13
14 puts((const char*)list);
15 return ret;
16}
diff --git a/tests/test_getgroups_static.c b/tests/test_getgroups_static.c
new file mode 100644
index 0000000..954654a
--- /dev/null
+++ b/tests/test_getgroups_static.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 gid_t list[12] = {0};
7
8 getgroups(10, list);
9
10 CHK_FAIL_START
11 getgroups(14, list);
12 CHK_FAIL_END
13
14 puts((const char*)list);
15 return ret;
16}
diff --git a/tests/test_gethostname_dynamic.c b/tests/test_gethostname_dynamic.c
new file mode 100644
index 0000000..4e18eca
--- /dev/null
+++ b/tests/test_gethostname_dynamic.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 gethostname(buffer, 6);
9
10 CHK_FAIL_START
11 gethostname(buffer, argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_gethostname_static.c b/tests/test_gethostname_static.c
new file mode 100644
index 0000000..9b8f8e1
--- /dev/null
+++ b/tests/test_gethostname_static.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8 gethostname(buffer, 10);
9
10 CHK_FAIL_START
11 gethostname(buffer, 14);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_getlogin_r_dynamic.c b/tests/test_getlogin_r_dynamic.c
new file mode 100644
index 0000000..b1e66f7
--- /dev/null
+++ b/tests/test_getlogin_r_dynamic.c
@@ -0,0 +1,19 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6#if _REENTRANT || _POSIX_C_SOURCE >= 199506L
7 char buffer[8] = {0};
8
9 getlogin_r(buffer, 6);
10
11 CHK_FAIL_START
12 getlogin_r(buffer, argc);
13 CHK_FAIL_END
14
15 puts(buffer);
16 return ret;
17#endif
18 return 0;
19}
diff --git a/tests/test_getlogin_r_static.c b/tests/test_getlogin_r_static.c
new file mode 100644
index 0000000..52638b9
--- /dev/null
+++ b/tests/test_getlogin_r_static.c
@@ -0,0 +1,19 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6#if _REENTRANT || _POSIX_C_SOURCE >= 199506L
7 char buffer[12] = {0};
8
9 getlogin_r(buffer, 10);
10
11 CHK_FAIL_START
12 getlogin_r(buffer, 14);
13 CHK_FAIL_END
14
15 puts(buffer);
16 return ret;
17#endif
18 return 0;
19}
diff --git a/tests/test_memcpy_dynamic_read.c b/tests/test_memcpy_dynamic_read.c
new file mode 100644
index 0000000..65cb77a
--- /dev/null
+++ b/tests/test_memcpy_dynamic_read.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7 memcpy(buffer, "1234567890", sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 memcpy(buffer, "123456", argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_memcpy_dynamic_write.c b/tests/test_memcpy_dynamic_write.c
new file mode 100644
index 0000000..60a594f
--- /dev/null
+++ b/tests/test_memcpy_dynamic_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 memcpy(buffer, "1234567890", sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 memcpy(buffer, "1234567890", argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_memcpy_static_read.c b/tests/test_memcpy_static_read.c
new file mode 100644
index 0000000..fed67a8
--- /dev/null
+++ b/tests/test_memcpy_static_read.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 memcpy(buffer, "123456", 4);
8 puts(buffer);
9
10 CHK_FAIL_START
11 memcpy(buffer, "123456", sizeof(buffer));
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_memcpy_static_write.c b/tests/test_memcpy_static_write.c
new file mode 100644
index 0000000..1a378f8
--- /dev/null
+++ b/tests/test_memcpy_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 memcpy(buffer, "1234567890", sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 memcpy(buffer, "1234567890", sizeof(buffer) + 1);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_memmove_dynamic_read.c b/tests/test_memmove_dynamic_read.c
new file mode 100644
index 0000000..1a01925
--- /dev/null
+++ b/tests/test_memmove_dynamic_read.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7 memmove(buffer, "1234567890", sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 memmove(buffer, "123456", argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_memmove_dynamic_write.c b/tests/test_memmove_dynamic_write.c
new file mode 100644
index 0000000..b62c01f
--- /dev/null
+++ b/tests/test_memmove_dynamic_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 memmove(buffer, "1234567890", sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 memmove(buffer, "1234567890", argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_memmove_static_read.c b/tests/test_memmove_static_read.c
new file mode 100644
index 0000000..fb128a6
--- /dev/null
+++ b/tests/test_memmove_static_read.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 memmove(buffer, "123456", 4);
8 puts(buffer);
9
10 CHK_FAIL_START
11 memmove(buffer, "123456", sizeof(buffer));
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_memmove_static_write.c b/tests/test_memmove_static_write.c
new file mode 100644
index 0000000..25166b6
--- /dev/null
+++ b/tests/test_memmove_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 (void)memmove(buffer, "1234567890", sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 (void)memmove(buffer, "1234567890", sizeof(buffer) + 1);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_mempcpy_dynamic_read.c b/tests/test_mempcpy_dynamic_read.c
new file mode 100644
index 0000000..9d9c59b
--- /dev/null
+++ b/tests/test_mempcpy_dynamic_read.c
@@ -0,0 +1,19 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <string.h>
5
6int main(int argc, char** argv) {
7#if !defined(__clang__)
8 char buffer[12] = {0};
9 mempcpy(buffer, "1234567890", sizeof(buffer) - 1);
10 puts(buffer);
11
12 CHK_FAIL_START
13 mempcpy(buffer, "123456", argc);
14 CHK_FAIL_END
15
16 puts(buffer);
17#endif
18 return ret;
19}
diff --git a/tests/test_mempcpy_dynamic_write.c b/tests/test_mempcpy_dynamic_write.c
new file mode 100644
index 0000000..a5463f9
--- /dev/null
+++ b/tests/test_mempcpy_dynamic_write.c
@@ -0,0 +1,19 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <string.h>
5
6int main(int argc, char** argv) {
7#if !defined(__clang__)
8 char buffer[8] = {0};
9 mempcpy(buffer, "1234567890", sizeof(buffer) - 1);
10 puts(buffer);
11
12 CHK_FAIL_START
13 mempcpy(buffer, "1234567890", argc);
14 CHK_FAIL_END
15
16 puts(buffer);
17#endif
18 return ret;
19}
diff --git a/tests/test_mempcpy_static_read.c b/tests/test_mempcpy_static_read.c
new file mode 100644
index 0000000..1891baf
--- /dev/null
+++ b/tests/test_mempcpy_static_read.c
@@ -0,0 +1,19 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <string.h>
5
6int main(int argc, char** argv) {
7#if !defined(__clang__)
8 char buffer[8] = {0};
9 mempcpy(buffer, "123456", 4);
10 puts(buffer);
11
12 CHK_FAIL_START
13 mempcpy(buffer, "123456", sizeof(buffer));
14 CHK_FAIL_END
15
16 puts(buffer);
17#endif
18 return ret;
19}
diff --git a/tests/test_mempcpy_static_write.c b/tests/test_mempcpy_static_write.c
new file mode 100644
index 0000000..b2d6bd9
--- /dev/null
+++ b/tests/test_mempcpy_static_write.c
@@ -0,0 +1,19 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <string.h>
5
6int main(int argc, char** argv) {
7#if !defined(__clang__)
8 char buffer[8] = {0};
9 mempcpy(buffer, "1234567890", sizeof(buffer) - 1);
10 puts(buffer);
11
12 CHK_FAIL_START
13 mempcpy(buffer, "1234567890", sizeof(buffer) + 1);
14 CHK_FAIL_END
15
16 puts(buffer);
17#endif
18 return ret;
19}
diff --git a/tests/test_memset_dynamic_write.c b/tests/test_memset_dynamic_write.c
new file mode 100644
index 0000000..5e1d8a3
--- /dev/null
+++ b/tests/test_memset_dynamic_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 memset(buffer, 0, sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 memset(buffer, 0, argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_memset_static_write.c b/tests/test_memset_static_write.c
new file mode 100644
index 0000000..dc30ed8
--- /dev/null
+++ b/tests/test_memset_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 memset(buffer, 0, sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 memset(buffer, 0, sizeof(buffer) + 1);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_poll_dynamic.c b/tests/test_poll_dynamic.c
new file mode 100644
index 0000000..284ceee
--- /dev/null
+++ b/tests/test_poll_dynamic.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <poll.h>
4
5int main(int argc, char** argv) {
6 struct pollfd buffer[8] = {0};
7
8 CHK_FAIL_START
9 poll(buffer, argc, 0);
10 CHK_FAIL_END
11
12 puts((const char*)buffer);
13 return ret;
14}
diff --git a/tests/test_poll_static.c b/tests/test_poll_static.c
new file mode 100644
index 0000000..b3dfd50
--- /dev/null
+++ b/tests/test_poll_static.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <poll.h>
4
5int main(int argc, char** argv) {
6 struct pollfd buffer[12] = {0};
7
8 CHK_FAIL_START
9 poll(buffer, 14, 0);
10 CHK_FAIL_END
11
12 puts((const char*)buffer);
13 return ret;
14}
diff --git a/tests/test_ppoll_dynamic.c b/tests/test_ppoll_dynamic.c
new file mode 100644
index 0000000..32ea522
--- /dev/null
+++ b/tests/test_ppoll_dynamic.c
@@ -0,0 +1,17 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <poll.h>
5
6int main(int argc, char** argv) {
7#if !defined(__clang__)
8 struct pollfd buffer[8] = {0};
9
10 CHK_FAIL_START
11 ppoll(buffer, argc, NULL, NULL);
12 CHK_FAIL_END
13
14 puts((const char*)buffer);
15#endif
16 return ret;
17}
diff --git a/tests/test_ppoll_static.c b/tests/test_ppoll_static.c
new file mode 100644
index 0000000..c5e0155
--- /dev/null
+++ b/tests/test_ppoll_static.c
@@ -0,0 +1,17 @@
1#include "common.h"
2
3#define _GNU_SOURCE
4#include <poll.h>
5
6int main(int argc, char** argv) {
7#if !defined(__clang__)
8 struct pollfd buffer[12] = {0};
9
10 CHK_FAIL_START
11 ppoll(buffer, 14, NULL, NULL);
12 CHK_FAIL_END
13
14 puts((const char*)buffer);
15#endif
16 return ret;
17}
diff --git a/tests/test_read_dynamic.c b/tests/test_read_dynamic.c
new file mode 100644
index 0000000..d502b3d
--- /dev/null
+++ b/tests/test_read_dynamic.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 CHK_FAIL_START
9 read(0, buffer, argc);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_read_static.c b/tests/test_read_static.c
new file mode 100644
index 0000000..97b4535
--- /dev/null
+++ b/tests/test_read_static.c
@@ -0,0 +1,15 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8
9 CHK_FAIL_START
10 read(0, buffer, 14);
11 CHK_FAIL_END
12
13 puts(buffer);
14 return ret;
15}
diff --git a/tests/test_readlink_dynamic.c b/tests/test_readlink_dynamic.c
new file mode 100644
index 0000000..64aff22
--- /dev/null
+++ b/tests/test_readlink_dynamic.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 readlink("", buffer, 6);
9
10 CHK_FAIL_START
11 readlink("", buffer, argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_readlink_static.c b/tests/test_readlink_static.c
new file mode 100644
index 0000000..39b9d6a
--- /dev/null
+++ b/tests/test_readlink_static.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8 readlink("", buffer, 10);
9
10 CHK_FAIL_START
11 readlink("", buffer, 14);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_recv_dynamic.c b/tests/test_recv_dynamic.c
new file mode 100644
index 0000000..5084d28
--- /dev/null
+++ b/tests/test_recv_dynamic.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/socket.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 CHK_FAIL_START
9 recv(0, buffer, argc, 0);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_recv_static.c b/tests/test_recv_static.c
new file mode 100644
index 0000000..21592eb
--- /dev/null
+++ b/tests/test_recv_static.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/socket.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8 CHK_FAIL_START
9 recv(0, buffer, 14, 0);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_recvfrom_dynamic.c b/tests/test_recvfrom_dynamic.c
new file mode 100644
index 0000000..c321187
--- /dev/null
+++ b/tests/test_recvfrom_dynamic.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/socket.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 CHK_FAIL_START
9 recvfrom(0, buffer, argc, 0, NULL, NULL);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_recvfrom_static.c b/tests/test_recvfrom_static.c
new file mode 100644
index 0000000..8e95d43
--- /dev/null
+++ b/tests/test_recvfrom_static.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/socket.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8 CHK_FAIL_START
9 recvfrom(0, buffer, 14, 0, NULL, NULL);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_select_dynamic.c b/tests/test_select_dynamic.c
new file mode 100644
index 0000000..e67baf3
--- /dev/null
+++ b/tests/test_select_dynamic.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <sys/select.h>
4
5int main(int argc, char** argv) {
6#if !defined(__clang__)
7 fd_set rfds;
8
9 CHK_FAIL_START
10 select(FD_SETSIZE + argc, &rfds, NULL, NULL, NULL);
11 CHK_FAIL_END
12
13 puts((const char*)&rfds);
14#endif
15 return ret;
16}
diff --git a/tests/test_select_static.c b/tests/test_select_static.c
new file mode 100644
index 0000000..c2abf7f
--- /dev/null
+++ b/tests/test_select_static.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <sys/select.h>
4
5int main(int argc, char** argv) {
6#if !defined(__clang__)
7 fd_set rfds;
8
9 CHK_FAIL_START
10 select(1337, &rfds, NULL, NULL, NULL);
11 CHK_FAIL_END
12
13 puts((const char*)&rfds);
14#endif
15 return ret;
16}
diff --git a/tests/test_send_dynamic.c b/tests/test_send_dynamic.c
new file mode 100644
index 0000000..13e2399
--- /dev/null
+++ b/tests/test_send_dynamic.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/socket.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 CHK_FAIL_START
9 send(0, buffer, argc, 0);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_send_static.c b/tests/test_send_static.c
new file mode 100644
index 0000000..f65811f
--- /dev/null
+++ b/tests/test_send_static.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/socket.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8 CHK_FAIL_START
9 send(0, buffer, 14, 0);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_sendto_dynamic.c b/tests/test_sendto_dynamic.c
new file mode 100644
index 0000000..9ab5dcc
--- /dev/null
+++ b/tests/test_sendto_dynamic.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/socket.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 CHK_FAIL_START
9 sendto(0, buffer, argc, 0, NULL, 0);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_sendto_static.c b/tests/test_sendto_static.c
new file mode 100644
index 0000000..5bfa851
--- /dev/null
+++ b/tests/test_sendto_static.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <sys/socket.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8 CHK_FAIL_START
9 sendto(0, buffer, 14, 0, NULL, 0);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_sprintf.c b/tests/test_sprintf.c
new file mode 100644
index 0000000..166b0f8
--- /dev/null
+++ b/tests/test_sprintf.c
@@ -0,0 +1,9 @@
1#include "common.h"
2
3#include <stdio.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7 sprintf(buffer, "%s", "1234567");
8 return 0;
9}
diff --git a/tests/test_sprintf_62.c b/tests/test_sprintf_62.c
new file mode 100644
index 0000000..3a84a1f
--- /dev/null
+++ b/tests/test_sprintf_62.c
@@ -0,0 +1,21 @@
1#include "common.h"
2
3#include <stdio.h>
4
5static char *offstr(char *str)
6{
7 int len = 0;
8
9 len = sprintf(str, "%s+0x%lx", "foo", (long unsigned int)0);
10 sprintf(str+len, " (%s+0x%lx)","bar", (long unsigned int)0);
11 if (len < 0)
12 return NULL;
13 return str;
14}
15
16int main() {
17 char buf[100];
18 char *c = offstr(buf);
19 printf("%s\n", c);
20 return 0;
21}
diff --git a/tests/test_stpcpy_dynamic_write.c b/tests/test_stpcpy_dynamic_write.c
new file mode 100644
index 0000000..0cacda7
--- /dev/null
+++ b/tests/test_stpcpy_dynamic_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 stpcpy(buffer, "1234567");
8 puts(buffer);
9
10 CHK_FAIL_START
11 stpcpy(buffer, argv[1]);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_stpcpy_static_write.c b/tests/test_stpcpy_static_write.c
new file mode 100644
index 0000000..6eff5a5
--- /dev/null
+++ b/tests/test_stpcpy_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 stpcpy(buffer, "1234567");
8 puts(buffer);
9
10 CHK_FAIL_START
11 stpcpy(buffer, "1234567890");
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_stpncpy_dynamic_write.c b/tests/test_stpncpy_dynamic_write.c
new file mode 100644
index 0000000..d315ee8
--- /dev/null
+++ b/tests/test_stpncpy_dynamic_write.c
@@ -0,0 +1,17 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[] = {'A', 'B', 'C', 'D', 'E', 'F'};
7
8 stpncpy(buffer, "1234567", 3);
9 puts(buffer);
10
11 CHK_FAIL_START
12 stpncpy(buffer, argv[1], argc);
13 CHK_FAIL_END
14
15 puts(buffer);
16 return ret;
17}
diff --git a/tests/test_stpncpy_static_write.c b/tests/test_stpncpy_static_write.c
new file mode 100644
index 0000000..4bf9092
--- /dev/null
+++ b/tests/test_stpncpy_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 stpncpy(buffer, "1234567", 5);
8 puts(buffer);
9
10 CHK_FAIL_START
11 stpncpy(buffer, "1234567890", 10);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_strcat_static_write.c b/tests/test_strcat_static_write.c
new file mode 100644
index 0000000..d0cb903
--- /dev/null
+++ b/tests/test_strcat_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 strcat(buffer, "1234567");
8 puts(buffer);
9
10 CHK_FAIL_START
11 strcat(buffer, "1234567890");
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
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
5int 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_strcpy_static_write.c b/tests/test_strcpy_static_write.c
new file mode 100644
index 0000000..a3e8100
--- /dev/null
+++ b/tests/test_strcpy_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <string.h>
4
5int 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, "1234567890");
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_strlcat_dynamic_write.c b/tests/test_strlcat_dynamic_write.c
new file mode 100644
index 0000000..68e2244
--- /dev/null
+++ b/tests/test_strlcat_dynamic_write.c
@@ -0,0 +1,21 @@
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#if !defined(__clang__)
10 char buffer[8] = {0};
11 strlcat(buffer, "1234567", sizeof(buffer));
12 puts(buffer);
13
14 CHK_FAIL_START
15 strlcat(buffer, argv[1], argc);
16 CHK_FAIL_END
17
18 puts(buffer);
19#endif
20 return ret;
21}
diff --git a/tests/test_strlcat_static_write.c b/tests/test_strlcat_static_write.c
new file mode 100644
index 0000000..b840372
--- /dev/null
+++ b/tests/test_strlcat_static_write.c
@@ -0,0 +1,21 @@
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#if !defined(__clang__)
10 char buffer[8] = {0};
11 strlcat(buffer, "1234567", sizeof(buffer));
12 puts(buffer);
13
14 CHK_FAIL_START
15 strlcat(buffer, "1234567890", 10);
16 CHK_FAIL_END
17
18 puts(buffer);
19#endif
20 return ret;
21}
diff --git a/tests/test_strlcpy_dynamic_write.c b/tests/test_strlcpy_dynamic_write.c
new file mode 100644
index 0000000..9dd2a82
--- /dev/null
+++ b/tests/test_strlcpy_dynamic_write.c
@@ -0,0 +1,21 @@
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#if !defined(__clang__)
10 char buffer[8] = {0};
11 strlcpy(buffer, "1234567", sizeof(buffer));
12 puts(buffer);
13
14 CHK_FAIL_START
15 strlcpy(buffer, argv[1], argc);
16 CHK_FAIL_END
17
18 puts(buffer);
19#endif
20 return ret;
21}
diff --git a/tests/test_strlcpy_static_write.c b/tests/test_strlcpy_static_write.c
new file mode 100644
index 0000000..e9d8994
--- /dev/null
+++ b/tests/test_strlcpy_static_write.c
@@ -0,0 +1,21 @@
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#if !defined(__clang__)
10 char buffer[8] = {0};
11 strlcpy(buffer, "1234567", sizeof(buffer));
12 puts(buffer);
13
14 CHK_FAIL_START
15 strlcpy(buffer, "1234567890", 10);
16 CHK_FAIL_END
17
18 puts(buffer);
19#endif
20 return ret;
21}
diff --git a/tests/test_strncat_dynamic_write.c b/tests/test_strncat_dynamic_write.c
new file mode 100644
index 0000000..d5c5a94
--- /dev/null
+++ b/tests/test_strncat_dynamic_write.c
@@ -0,0 +1,18 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 strncat(buffer, "1234567", 5);
8 puts(buffer);
9
10#if 0
11 CHK_FAIL_START
12 strncat(buffer, argv[1], argc);
13 CHK_FAIL_END
14#endif
15
16 puts(buffer);
17 return ret;
18}
diff --git a/tests/test_strncat_static_write.c b/tests/test_strncat_static_write.c
new file mode 100644
index 0000000..7fe89ff
--- /dev/null
+++ b/tests/test_strncat_static_write.c
@@ -0,0 +1,19 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 char src[] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};
8 strncat(buffer, src, 5);
9 puts(buffer);
10
11#if 0
12 CHK_FAIL_START
13 strncat(buffer, src, 10);
14 CHK_FAIL_END
15#endif
16
17 puts(buffer);
18 return ret;
19}
diff --git a/tests/test_strncpy_dynamic_write.c b/tests/test_strncpy_dynamic_write.c
new file mode 100644
index 0000000..c779267
--- /dev/null
+++ b/tests/test_strncpy_dynamic_write.c
@@ -0,0 +1,18 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 char src[] = {'A', 'B', 'C', 'D', 'E', 'F'};
8
9 strncpy(buffer, src, 5);
10 puts(buffer);
11
12 CHK_FAIL_START
13 strncpy(buffer, argv[1], argc);
14 CHK_FAIL_END
15
16 puts(buffer);
17 return ret;
18}
diff --git a/tests/test_strncpy_static_write.c b/tests/test_strncpy_static_write.c
new file mode 100644
index 0000000..29905ac
--- /dev/null
+++ b/tests/test_strncpy_static_write.c
@@ -0,0 +1,18 @@
1#include "common.h"
2
3#include <string.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 char src[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'};
8
9 strncpy(buffer, src, 5);
10 puts(buffer);
11
12 CHK_FAIL_START
13 strncpy(buffer, src, 10);
14 CHK_FAIL_END
15
16 puts(buffer);
17 return ret;
18}
diff --git a/tests/test_swab_dynamic_read.c b/tests/test_swab_dynamic_read.c
new file mode 100644
index 0000000..3ad011a
--- /dev/null
+++ b/tests/test_swab_dynamic_read.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7 swab("1234567890", buffer, sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 swab("123456", buffer, argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_swab_dynamic_write.c b/tests/test_swab_dynamic_write.c
new file mode 100644
index 0000000..bd3efa4
--- /dev/null
+++ b/tests/test_swab_dynamic_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 swab("1234567890", buffer, sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 swab("1234567890", buffer, argc);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_swab_static_read.c b/tests/test_swab_static_read.c
new file mode 100644
index 0000000..fa068c1
--- /dev/null
+++ b/tests/test_swab_static_read.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 swab("123456", buffer, 4);
8 puts(buffer);
9
10 CHK_FAIL_START
11 swab("123456", buffer, sizeof(buffer));
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_swab_static_write.c b/tests/test_swab_static_write.c
new file mode 100644
index 0000000..ccf3a90
--- /dev/null
+++ b/tests/test_swab_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7 swab("1234567890", buffer, sizeof(buffer) - 1);
8 puts(buffer);
9
10 CHK_FAIL_START
11 swab("1234567890", buffer, sizeof(buffer) + 1);
12 CHK_FAIL_END
13
14 puts(buffer);
15 return ret;
16}
diff --git a/tests/test_ttyname_r_dynamic.c b/tests/test_ttyname_r_dynamic.c
new file mode 100644
index 0000000..3a640f7
--- /dev/null
+++ b/tests/test_ttyname_r_dynamic.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 CHK_FAIL_START
9 ttyname_r(0, buffer, argc);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_ttyname_r_static.c b/tests/test_ttyname_r_static.c
new file mode 100644
index 0000000..89afc2b
--- /dev/null
+++ b/tests/test_ttyname_r_static.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8 CHK_FAIL_START
9 ttyname_r(0, buffer, 14);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_vsnprintf_dynamic.c b/tests/test_vsnprintf_dynamic.c
new file mode 100644
index 0000000..474ba26
--- /dev/null
+++ b/tests/test_vsnprintf_dynamic.c
@@ -0,0 +1,29 @@
1#include "common.h"
2
3#include <stdarg.h>
4#include <unistd.h>
5
6char buffer[8] = {0};
7
8int msg_valid(int n, const char * format, ... ) {
9 va_list args;
10 va_start (args, format);
11 vsnprintf(buffer, n, format, args);
12 va_end (args);
13 return 0;
14}
15
16int msg(int n, const char * format, ... ) {
17 va_list args;
18 va_start (args, format);
19 CHK_FAIL_START
20 vsnprintf(buffer, n, format, args);
21 CHK_FAIL_END
22 va_end (args);
23 return ret;
24}
25
26int main(int argc, char** argv) {
27 msg_valid(sizeof(buffer), "%s", "1234567890ABCDEF");
28 return msg(argc, "%s", "1234567890ABCDEF");
29}
diff --git a/tests/test_vsnprintf_static.c b/tests/test_vsnprintf_static.c
new file mode 100644
index 0000000..d6b7e9b
--- /dev/null
+++ b/tests/test_vsnprintf_static.c
@@ -0,0 +1,29 @@
1#include "common.h"
2
3#include <stdarg.h>
4#include <unistd.h>
5
6char buffer[12] = {0};
7
8int msg_valid(int n, const char * format, ... ) {
9 va_list args;
10 va_start (args, format);
11 vsnprintf(buffer, n, format, args);
12 va_end (args);
13 return 0;
14}
15
16int msg(int n, const char * format, ... ) {
17 va_list args;
18 va_start (args, format);
19 CHK_FAIL_START
20 vsnprintf(buffer, n, format, args);
21 CHK_FAIL_END
22 va_end (args);
23 return ret;
24}
25
26int main(int argc, char** argv) {
27 msg_valid(sizeof(buffer), "%s", "1234567890ABCDEF");
28 return msg(sizeof(buffer)+1, "%s", "1234567890ABCDEF");
29}
diff --git a/tests/test_vsprintf.c b/tests/test_vsprintf.c
new file mode 100644
index 0000000..bd5b893
--- /dev/null
+++ b/tests/test_vsprintf.c
@@ -0,0 +1,29 @@
1#include "common.h"
2
3#include <stdarg.h>
4#include <unistd.h>
5
6char buffer[12] = {0};
7
8int msg_valid(const char * format, ... ) {
9 va_list args;
10 va_start (args, format);
11 vsprintf(buffer, format, args);
12 va_end (args);
13 return 0;
14}
15
16int msg(const char * format, ... ) {
17 va_list args;
18 va_start (args, format);
19 CHK_FAIL_START
20 vsprintf(buffer, format, args);
21 CHK_FAIL_END
22 va_end (args);
23 return ret;
24}
25
26int main(int argc, char** argv) {
27 msg_valid("%s", "1234567");
28 return msg("%s", "1234567890ABCDEF");
29}
diff --git a/tests/test_wcscat_static_write.c b/tests/test_wcscat_static_write.c
new file mode 100644
index 0000000..fe00baa
--- /dev/null
+++ b/tests/test_wcscat_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <wchar.h>
4
5int main(int argc, char** argv) {
6 wchar_t buffer[8] = {0};
7 wcscat(buffer, L"α");
8 printf("%ls\n", buffer);
9
10 CHK_FAIL_START
11 wcscat(buffer, L"αβγδεζηθικλμνξοπρστυφχψω");
12 CHK_FAIL_END
13
14 printf("%ls\n", buffer);
15 return ret;
16}
diff --git a/tests/test_wcscpy_static_write.c b/tests/test_wcscpy_static_write.c
new file mode 100644
index 0000000..fd4ec78
--- /dev/null
+++ b/tests/test_wcscpy_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <wchar.h>
4
5int main(int argc, char** argv) {
6 wchar_t buffer[8] = {0};
7 wcscpy(buffer, L"α");
8 printf("%ls\n", buffer);
9
10 CHK_FAIL_START
11 wcscpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω");
12 CHK_FAIL_END
13
14 printf("%ls\n", buffer);
15 return ret;
16}
diff --git a/tests/test_wcsncat_static_write.c b/tests/test_wcsncat_static_write.c
new file mode 100644
index 0000000..220d0dd
--- /dev/null
+++ b/tests/test_wcsncat_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <wchar.h>
4
5int main(int argc, char** argv) {
6 wchar_t buffer[8] = {0};
7 wcsncat(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 2);
8 printf("%ls\n", buffer);
9
10 CHK_FAIL_START
11 wcsncat(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 1337);
12 CHK_FAIL_END
13
14 printf("%ls\n", buffer);
15 return ret;
16}
diff --git a/tests/test_wcsncpy_static_write.c b/tests/test_wcsncpy_static_write.c
new file mode 100644
index 0000000..a347f6c
--- /dev/null
+++ b/tests/test_wcsncpy_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <wchar.h>
4
5int main(int argc, char** argv) {
6 wchar_t buffer[8] = {0};
7 wcsncpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 1);
8 printf("%ls\n", buffer);
9
10 CHK_FAIL_START
11 wcsncpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 1337);
12 CHK_FAIL_END
13
14 printf("%ls\n", buffer);
15 return ret;
16}
diff --git a/tests/test_wmemcpy_dynamic_write.c b/tests/test_wmemcpy_dynamic_write.c
new file mode 100644
index 0000000..c7f5751
--- /dev/null
+++ b/tests/test_wmemcpy_dynamic_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <wchar.h>
4
5int main(int argc, char** argv) {
6 wchar_t buffer[2] = {0};
7 wmemcpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 2);
8 printf("%ls\n", buffer);
9
10 CHK_FAIL_START
11 wmemcpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", argc);
12 CHK_FAIL_END
13
14 printf("%ls\n", buffer);
15 return ret;
16}
diff --git a/tests/test_wmemcpy_static_write.c b/tests/test_wmemcpy_static_write.c
new file mode 100644
index 0000000..638d80d
--- /dev/null
+++ b/tests/test_wmemcpy_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <wchar.h>
4
5int main(int argc, char** argv) {
6 wchar_t buffer[2] = {0};
7 wmemcpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 2);
8 printf("%ls\n", buffer);
9
10 CHK_FAIL_START
11 wmemcpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 1337);
12 CHK_FAIL_END
13
14 printf("%ls\n", buffer);
15 return ret;
16}
diff --git a/tests/test_wmemmove_dynamic_write.c b/tests/test_wmemmove_dynamic_write.c
new file mode 100644
index 0000000..549afe3
--- /dev/null
+++ b/tests/test_wmemmove_dynamic_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <wchar.h>
4
5int main(int argc, char** argv) {
6 wchar_t buffer[2] = {0};
7 wmemmove(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 2);
8 printf("%ls\n", buffer);
9
10 CHK_FAIL_START
11 wmemmove(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", argc);
12 CHK_FAIL_END
13
14 printf("%ls\n", buffer);
15 return ret;
16}
diff --git a/tests/test_wmemmove_static_write.c b/tests/test_wmemmove_static_write.c
new file mode 100644
index 0000000..7200b95
--- /dev/null
+++ b/tests/test_wmemmove_static_write.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <wchar.h>
4
5int main(int argc, char** argv) {
6 wchar_t buffer[2] = {0};
7 wmemmove(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 2);
8 printf("%ls\n", buffer);
9
10 CHK_FAIL_START
11 wmemmove(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 1337);
12 CHK_FAIL_END
13
14 printf("%ls\n", buffer);
15 return ret;
16}
diff --git a/tests/test_wmemset_dynamic.c b/tests/test_wmemset_dynamic.c
new file mode 100644
index 0000000..5552bd8
--- /dev/null
+++ b/tests/test_wmemset_dynamic.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <wchar.h>
4
5int main(int argc, char** argv) {
6 wchar_t buffer[4] = {0};
7 wmemset(buffer, L'A', 3);
8 printf("%ls\n", buffer);
9
10 CHK_FAIL_START
11 wmemset(buffer, L'B', argc);
12 CHK_FAIL_END
13
14 printf("%ls\n", buffer);
15 return ret;
16}
diff --git a/tests/test_wmemset_static.c b/tests/test_wmemset_static.c
new file mode 100644
index 0000000..b09a684
--- /dev/null
+++ b/tests/test_wmemset_static.c
@@ -0,0 +1,16 @@
1#include "common.h"
2
3#include <wchar.h>
4
5int main(int argc, char** argv) {
6 wchar_t buffer[4] = {0};
7 wmemset(buffer, L'A', 3);
8 printf("%ls\n", buffer);
9
10 CHK_FAIL_START
11 wmemset(buffer, L'B', 16);
12 CHK_FAIL_END
13
14 printf("%ls\n", buffer);
15 return ret;
16}
diff --git a/tests/test_write_dynamic.c b/tests/test_write_dynamic.c
new file mode 100644
index 0000000..0b670f0
--- /dev/null
+++ b/tests/test_write_dynamic.c
@@ -0,0 +1,14 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[8] = {0};
7
8 CHK_FAIL_START
9 write(0, buffer, argc);
10 CHK_FAIL_END
11
12 puts(buffer);
13 return ret;
14}
diff --git a/tests/test_write_static.c b/tests/test_write_static.c
new file mode 100644
index 0000000..6b2cf90
--- /dev/null
+++ b/tests/test_write_static.c
@@ -0,0 +1,15 @@
1#include "common.h"
2
3#include <unistd.h>
4
5int main(int argc, char** argv) {
6 char buffer[12] = {0};
7
8
9 CHK_FAIL_START
10 write(0, buffer, 14);
11 CHK_FAIL_END
12
13 puts(buffer);
14 return ret;
15}