>Here is the PROOF you need.....
I don't need proof that I'm right. I can't believe you actually thought that using gets in an extremely controlled environment would mean anything. By gets not being safe, here's my proof:
#include <stdio.h>
int main ( void )
{
char pretest[20] = {0};
char dummy[2];
char posttest[20] = {0};
int x;
printf ( "Enter a number: " );
fflush ( stdout );
scanf ( "%d", &x );
gets ( dummy );
printf ( "pretest: \"%s\"\n", pretest );
printf ( "posttest: \"%s\"\n", posttest );
return 0;
}
Run that and type "123you're a moron". Overflowing a buffer is undefined, but with any luck you'll see something interesting.