Created
December 31, 2017 15:13
-
-
Save artem-smotrakov/6d0c774621afcfc3b2b1c72bf7cca549 to your computer and use it in GitHub Desktop.
Here is a very simple example of a global buffer overflow. See more on https://blog.gypsyengineer.com/fun/security/global-buffer-overflows.html
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 <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
char buffer[16]; | |
int main(int argc, char **argv) { | |
if(argc < 2) { | |
printf("no parameters specified\n"); | |
exit(-1); | |
} | |
// global buffer overflow may occur here | |
// if argv[1] has more than 16 symbols | |
strcpy(buffer, argv[1]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment