Last active
April 26, 2018 08:02
-
-
Save skout23/190a34351e57e195141cf8ae66751fe2 to your computer and use it in GitHub Desktop.
simple buffer_overflow for testing afl
This file contains 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
/* | |
Compile with: | |
afl-gcc -fno-stack-protector -z execstack buffer_overflow.c -o buffer_overflow | |
gcc -fno-stack-protector -z execstack buffer_overflow.c -o buffer_overflow | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int main(void) | |
{ | |
char login[32]; | |
char passwd[32]; | |
printf("Login: \n"); | |
gets(login); | |
printf("Password: \n"); | |
gets(passwd); | |
if (strcmp(login, "root") == 0) { | |
if (strcmp(passwd, "somwead") == 0) { | |
printf("Access granted!\n"); | |
return 0; | |
} | |
} | |
printf("Accesss Denied.\n"); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment