Created
January 8, 2019 06:34
-
-
Save saibikalpa/92419c65c472469ba73f8559ceca0454 to your computer and use it in GitHub Desktop.
Sample C program vulnerable to 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 <unistd.h> | |
int foo(){ | |
char buffer[600]; | |
int characters_read; | |
printf("Enter some string:\n"); | |
characters_read = read(0, buffer, 1000); | |
printf("You entered: %s", buffer); | |
return 0; | |
} | |
void main(){ | |
foo(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment