1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
/* * overflow.c * * Created on: 27.01.2012 * Author: druid */ #include <stdlib.h> #include <stdio.h> #include <string.h> /* 300 bytes buffer len + 4 bytes for overwrite return opcode */ #define BUFLEN 300 void overflow(const char *src) { char buf[BUFLEN]; /* exploitable function */ strcpy(&buf[0], src); /* nothing to do, just return */ } int main(int argc, char **argv) { if (argc > 1) { overflow(argv[1]); } else { fprintf(stderr, "arg1 missing\n"); return(1); } return (0); }