Discrete Mathematics
Buffer overflow, with a ROP chain.
void quiz() {
FILE *fp = fopen("flag.txt", "r");
char flag[100];
if (fp == NULL) {
puts("Sorry, all my stuff's a mess.");
puts("I'll get around to grading your quiz sometime.");
puts("[If you are seeing this on the remote server, please contact admin].");
exit(1);
}
fgets(flag, sizeof(flag), fp);
if (knows_logic && knows_algebra && knows_functions) {
puts("Alright, you passed this quiz.");
puts("Here's your prize:");
puts(flag);
} else {
puts("Not there yet...");
puts("Study some more!");
}
}





Last updated