*new* memset: check for memset(x, y, 0); typos
[smatch.git] / validation / sm_overflow2.c
blob50d9cb0c2113d107d98749b789d6009786adbd83
1 #include "check_debug.h"
3 void strncpy(char *to, char *from, int size);
5 void func (char *a, char *b)
7 strncpy(a, b, 5);
8 a[5] = '\0';
11 * check-name: smatch strncpy() overflow
12 * check-command: smatch --spammy -I.. sm_overflow2.c
14 * check-output-start
15 sm_overflow2.c +8 func(3) error: buffer overflow 'a' 5 <= 5
16 * check-output-end