|
(view this code in a separate window) /* * overflow.c * * Example C program with obvious buffer overflow. * * Copyright 2002, James Lee and Bri Hatch * * Released under the GPL. See COPYING file * for more information. * */ #include <stdio.h> main () { char userinput[99999]; /* bad idea - use fgets instead */ gets(userinput); overflow(userinput); exit(0); } int overflow( char *data) { char filename[1]; strcpy(filename, data); /* do something */ return 0; }
|