cppcheck/test/testsuites/duma/wrong7.c

14 lines
305 B
C
Raw Normal View History

2019-03-18 06:58:12 +01:00
#include <stdio.h>
int main() {
int *p;
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);
}