// use-after-free
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <assert.h>
|
|
|
|
int main() {
|
|
int *ptr = malloc(sizeof(*ptr));
|
|
assert(ptr);
|
|
*ptr = 42;
|
|
free(ptr);
|
|
printf("%d\n", *ptr); // use after free
|
|
*ptr = 43; // use after free
|
|
return 0;
|
|
}
|