Last active
January 8, 2017 21:50
-
-
Save aaronjwood/22c17b0bf6f271f38cf0db043d814abd to your computer and use it in GitHub Desktop.
Stack buffer overflow
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
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char **argv) { | |
char buff[15]; | |
int auth = 0; | |
printf("\nEnter password: "); | |
gets(buff); | |
if (strcmp(buff, "password") != 0) { | |
printf("\nAccess denied\n"); | |
} else { | |
auth = 1; | |
} | |
// Let's bypass this check! | |
if (auth) { | |
printf("\nAccess granted\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment