I just installed 12.04 (WUBI actually) and I wanted to learn a bit about buffer overflow. Unfortunately when I try to use a function like puts()
and gets()
in an incorrect manner (that is, to cause a buffer overflow), gcc
tells me that it detected smashing the stack
and terminate my program.
How do I enable stack overflow?
For more clarity, This is the program:
#include<stdio.h>
CanNeverExecute()
{
printf("I can never execute
");
exit(0);
}
GetInput()
{
char buffer[8];
gets(buffer);
puts(buffer);
}
main()
{
GetInput();
return 0;
}