1 #include <libcgc.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 /* Just leak 4 bytes from the flag page, performing a simple mutation on those bytes */
6
main(int secret_page_i)7 int __attribute((fastcall)) main(int secret_page_i)
8 {
9
10 char *heap= NULL;
11 char stack[4] = {0};
12
13 allocate(0x10, 0, &heap);
14
15 printf("Enter some data for heap: ");
16 receive(0, heap, 0x10, NULL);
17 printf("\n");
18
19
20 printf("Overflow this: ");
21 receive(0, stack, 8, NULL);
22 printf("\n");
23
24 printf("Here's what the heap is now: ");
25 printf("%s\n", heap);
26 }
27