gcc -fstack-protector-all option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am trying to test the buffer protection mechanism of gcc.

I am running gcc version 4.1.0 and here is my program.


#include<stdio.h>
#include<stdlib.h>

void buffer_overflow ( char* str)
{
long int val = 0;
for ( val = 0; val < 11999; val++){
str[val] = '\0';
}
}

int main ()
{
char str[29];

buffer_overflow ( str);

exit ( 0);
}


Even after compiling this program with command "gcc -fstack-protector-all
buffer_overflow.c", exactable runs fine without any error.

Please not that the limit (11999) in function can very from system to
system, so please don't reply that it's giving error on your system.

According to my thinking even after writing one byte more it should throw
out an error.

Even after increasing the limit, program gives segmentation fault, whereas
it should give program error.

Please help me in getting answer for this, or please guide me to any forum
on net where I can get answer of this question.
-- 
View this message in context: http://www.nabble.com/gcc--fstack-protector-all-option-tf2126623.html#a5867717
Sent from the gcc - Help forum at Nabble.com.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux