db/fixup_kernel.sh: hack handling of _parse_integer()
[smatch.git] / validation / sm_overflow3.c
blob565518066d9462fa4b4f7f21e87103306d8a90f3
1 #include "check_debug.h"
3 void strcpy(char *to, char *from, int size);
5 void func (char *a, char *b)
7 char c[4];
8 char d[4];
9 char e[4];
10 char f[4];
12 b = "1234";
13 strcpy(a, b);
14 a[5] = '\0';
15 strcpy(c, b);
16 strcpy(d, "123");
17 strcpy(e, "1234");
18 strcpy(f, "12");
19 f[3] = '\0';
22 * check-name: smatch strcpy overflow
23 * check-command: smatch -I.. sm_overflow3.c
25 * check-output-start
26 sm_overflow3.c:15 func() error: strcpy() 'b' too large for 'c' (5 vs 4)
27 sm_overflow3.c:17 func() error: strcpy() '"1234"' too large for 'e' (5 vs 4)
28 * check-output-end