math: improve how get_absolute_min/max() work
[smatch.git] / validation / sm_strlen2.c
blob02a13b1cb54ac500c0374b6f1dc8125ba93b60a1
1 int strlen(char *str);
2 int strcpy(char *str);
4 void func (char *input1, char *input2, char *input3)
6 char buf[4];
8 if (strlen(input1) > 4)
9 return;
10 strcpy(buf, input1);
12 if (10 > strlen(input2))
13 strcpy(buf, input2);
15 if (strlen(input3) <= 4)
16 strcpy(buf, input3);
19 * check-name: Smatch strlen test #2
20 * check-command: smatch sm_strlen2.c
22 * check-output-start
23 sm_strlen2.c:10 func() error: strcpy() 'input1' too large for 'buf' (5 vs 4)
24 sm_strlen2.c:13 func() error: strcpy() 'input2' too large for 'buf' (10 vs 4)
25 sm_strlen2.c:16 func() error: strcpy() 'input3' too large for 'buf' (5 vs 4)
26 * check-output-end