Skip to content

Instantly share code, notes, and snippets.

@retpolanne
Created March 24, 2019 00:30
Show Gist options
  • Save retpolanne/e56c5e5f06e450ffc9913dbd751edb9c to your computer and use it in GitHub Desktop.
Save retpolanne/e56c5e5f06e450ffc9913dbd751edb9c to your computer and use it in GitHub Desktop.
Example code for buffer overflow vuln with gets
// To compile: gcc -fno-stack-protector -o boverflow_gets boverflow_gets.c
// To run (test): python -c "print 'a'*<some number>" | ./boverflow_gets
#include <stdio.h>
#include <string.h>
int main() {
char buffer[16];
gets(buffer);
printf("%s", buffer);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment