math: fix an out of memory issue
[smatch.git] / validation / sm_overflow5.c
blobe930e50a9ac7244e25b521193d04f2420a5fd514
1 #include "check_debug.h"
3 void memdup(char *to, int size);
4 void strcpy(char *dest, char *src);
6 void func (char *a, char *b)
8 char c[5];
10 a = memdup(b, 5);
11 strcpy(c, a);
12 a[5] = '\0';
15 * check-name: smatch memdup overflow
16 * check-command: smatch -I.. sm_overflow5.c
18 * check-output-start
19 sm_overflow5.c:12 func() error: buffer overflow 'a' 5 <= 5
20 * check-output-end