Skip to content

Instantly share code, notes, and snippets.

@artem-smotrakov
Created December 31, 2017 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artem-smotrakov/6d0c774621afcfc3b2b1c72bf7cca549 to your computer and use it in GitHub Desktop.
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
#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