Skip to content

Instantly share code, notes, and snippets.

@skout23 skout23/buffer_overflow.c
Last active Apr 26, 2018

Embed
What would you like to do?
simple buffer_overflow for testing afl
/*
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
You can’t perform that action at this time.