1 #include "check_debug.h"
2 
3 void strndup(char *to, int size);
4 void strcpy(char *dest, char *src);
5 
func(char * a,char * b)6 void func (char *a, char *b)
7 {
8 	char c[5];
9 
10 	a = strndup(b, 5);
11 	strcpy(c, a);
12 }
13 /*
14  * check-name: smatch strndup overflow
15  * check-command: smatch -I.. sm_overflow4.c
16  *
17  * check-output-start
18 sm_overflow4.c:11 func() error: strcpy() 'a' too large for 'c' (6 vs 5)
19  * check-output-end
20  */
21