On Thursday 29 December 2005 22.44, Ted Unangst wrote: > On 12/29/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > -fstack-protector : Enable stack protection for functions which contain > > character arrays. > > -fno-stack-protector : Disable use of stack protection (ProPolice). > > -fstack-protector-all : Enable stack protection for all functions. > > -fno-stack-protector-all : Disables stack protection for all functions. > > > > this does not yet explain the observed behavior since 'foo' contains a > > character array. but it pointed me to fstack-protector-all. using this > > option the smash is caught. > > i think it has to be 8 bytes unless you are using -f-all thanks! wow new definition of what is a character array - i propose a change of the c-standard :)
while it makes sense in practise it is quite confusing. -> this should defiantly be put into the man-page! thanks again > > > why only the smash in the main is detected? > > > > i used the following example: > > > > #include <stdio.h> > > > > char *src = "sehr langer string"; > > > > void foo( char * src ) > > { > > char dst[5]; > > strcpy( dst, src ); > > } > > int main(int argc, char* argv[]) > > { > > #ifdef SMASH_MAIN > > char dst[5]; > > strcpy( dst, src ); > > #else > > foo( src ); > > #endif > > return 0; > > }