cppcheck/test/testsuites/duma/wrong7.c

14 lines
321 B
C
Raw Normal View History

2019-03-18 06:58:12 +01:00
#include <stdio.h>
int main() {
2021-08-07 20:51:18 +02:00
int *p;
2019-03-18 06:58:12 +01:00
2021-08-07 20:51:18 +02:00
p = (int*) malloc( sizeof(int) * 10 );
printf("Now writing before our allocated array\n");
p[-1] ^= 0x0F; /* bash before */
printf("... and now after our allocated array\n");
p[10] ^= 0x0F; /* bash after */
printf("Did you notice?\n");
free(p);
2019-03-18 06:58:12 +01:00
}