Created
January 22, 2015 08:43
-
-
Save awsong/d0fc069f88638c75c033 to your computer and use it in GitHub Desktop.
Buffer Overflow
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
#include <stdio.h> | |
#include <string.h> | |
int main(void) | |
{ | |
char buff[15]; | |
int pass = 0; | |
printf("\n Enter the password : \n"); | |
gets(buff); | |
if(strcmp(buff, "thegeekstuff")) | |
{ | |
printf ("\n Wrong Password \n"); | |
} | |
else | |
{ | |
printf ("\n Correct Password \n"); | |
pass = 1; | |
} | |
if(pass) | |
{ | |
/* Now Give root or admin rights to user*/ | |
printf ("\n Root privileges given to the user \n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment