1 int strlen(char *str);
2 int strcpy(char *str);
3 
func(char * input1,char * input2,char * input3)4 void func (char *input1, char *input2, char *input3)
5 {
6 	char buf1[4];
7 	char buf2[4];
8 	char buf3[4];
9 
10 	if (strlen(input1) > 4)
11 		return;
12 	strcpy(buf1, input1);
13 
14 	if (10 > strlen(input2))
15 		strcpy(buf2, input2);
16 
17 	if (strlen(input3) <= 4)
18 		strcpy(buf3, input3);
19 }
20 /*
21  * check-name: Smatch strlen test #2
22  * check-command: smatch sm_strlen2.c
23  *
24  * check-output-start
25 sm_strlen2.c:12 func() error: strcpy() 'input1' too large for 'buf1' (5 vs 4)
26 sm_strlen2.c:15 func() error: strcpy() 'input2' too large for 'buf2' (10 vs 4)
27 sm_strlen2.c:18 func() error: strcpy() 'input3' too large for 'buf3' (5 vs 4)
28  * check-output-end
29  */
30