[EMAIL PROTECTED] asked:
> [Why does this program not crash?]
>
> main()
> {
> char *s;
> s = (char*)malloc(0);
> strcpy(s,"fffff");
> printf("%s\n",s);
> }
It doesn't crash because the standard malloc is
optimized for speed, not for finding bugs.
Try linking it with a debugging malloc, e.g.
cc bug.c -lefence
and watch it dump core.
- Dan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/
- Re: malloc(1/0) ?? Igmar Palsenberg
- RE: malloc(1/0) ?? Andrej Hosna
- RE: malloc(1/0) ?? David Schwartz
- RE: malloc(1/0) ?? Igmar Palsenberg
- Re: malloc(1/0) ?? H. Peter Anvin
- Re: malloc(1/0) ?? Rasmus Andersen
- Re: malloc(1/0) ?? Igmar Palsenberg
- Re: malloc(1/0) ?? Igmar Palsenberg
- Re: malloc(1/0) ?? Tim Waugh
- Re: malloc(1/0) ?? Igmar Palsenberg
- Re: malloc(1/0) ?? Dan Kegel
- Re: malloc(1/0) ?? J. Dow
- RE: malloc(1/0) ?? David Schwartz
- Re: malloc(1/0) ?? Igmar Palsenberg
- RE: malloc(1/0) ?? Jesse Pollard
- RE: malloc(1/0) ?? lost

