3 #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
5 int a
[] = {1, 2, 3, 4};
13 if (x
< ARRAY_SIZE(a
))
15 if (x
< ARRAY_SIZE(b
))
17 if (x
< ARRAY_SIZE(b
))
19 printf("%d\n", ARRAY_SIZE(b
));
22 * check-name: smatch indexed array check
23 * check-command: smatch sm_array_overflow2.c
26 sm_array_overflow2.c:18 main() error: buffer overflow 'b' 4 <= 4