Created
July 31, 2014 15:34
-
-
Save Cee/f4cc0270a4c57aa036b3 to your computer and use it in GitHub Desktop.
Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void test() { | |
volatile unsigned long long val; | |
volatile unsigned long long local = 0xdeadbeef; | |
char* variable_length; | |
entry_check(3); /* Make sure entered this function properly */ | |
val = getbuf(); | |
if (val <= 40) { | |
variable_length = alloca(val); | |
} | |
entry_check(3); | |
/* Check for corrupted stack */ | |
if (local != 0xdeadbeef) { | |
printf("Sabotaged!: the stack has been corrupted\n"); | |
} | |
else if (val == cookie) { | |
printf("Boom!: getbuf returned 0x%llx\n", val); | |
if (local != 0xdeadbeef) { | |
printf("Sabotaged!: the stack has been corrupted\n"); | |
} | |
if (val != cookie) { | |
printf("Sabotaged!: control flow has been disrupted\n"); | |
} | |
validate(3); | |
} else { | |
printf("Dud: getbuf returned 0x%llx\n", val); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment