Created
April 8, 2019 02:15
-
-
Save umair-khokhar/5508271c22be33b055d3867a2b731f93 to your computer and use it in GitHub Desktop.
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> | |
| #include <stdlib.h> | |
| #define MAX_WORD_LENGTH 5 | |
| int main(int argc, char *argv[]) | |
| { | |
| char password[5]; | |
| int authenticate = 0; | |
| printf("Enter a word (<%d chars): ", MAX_WORD_LENGTH); | |
| fflush(stdout); | |
| scanf("%s", password); /* DANGER: vulnerable to buffer overflow*/ | |
| if(strcmp(password, "correct") == 0) | |
| authenticate = 1; | |
| if(authenticate) | |
| printf("You are authorized"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment