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
>
> 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;
> }