GCC Bugzilla – Bug 56046
the buffer overflow can escape from the stack protection in 64-bit linux system
Last modified: 2013-01-19 16:47:30 UTC
Created attachment 29219 [details]
the bug code
system version :64-bit Ubuntu 12.04 lts
gcc version: 4.6.3
options:gcc source.c -o source
When compile and run a program with an error which will cause buffer overflow,the compiler can not dectect it.
The program below can compile and run correctly in my system(also works on my friend system which is no ubuntu but with gcc version 4.5.0)
const char *a="123456789abcdef";
I attempt to copy a string whose length is 15 to a array whose length is 10,and it compiles and run correctly.The output is "123456789abcdef,15".
p.s. This will not succeed in 32-bit linux system.
My freinds tests my code in CentOS!
The stack protection code cannot guarantee to detect every error.