Odd .....

Kurt Wall kwall
Fri Jun 16 21:06:04 PDT 2006


On Fri, Jun 16, 2006 at 10:03:57AM -0500, Ben Duncan wrote:
> In one of my test C programs, malloc'd a 2048 byte memory page.
> I decided to see if I could segfault it (testing a thery)
> and it did NOT segfault ... what Am I doing wrong, or is this
> just how things works ... And is there a way to test for
> any of these buffer overruns ?

You just got lucky. To test for buffer overruns, underruns, double frees, and use
after free, I typically link (during testing) with ElectricFence (libefence), so
the proper environment variables, and then test.

http://freshmeat.net/projects/efence/

Other alternatives include various malloc() replacements (such as dmalloc , valgrind, 
and something called "DUMA" that is a fork of ElectricFence.

dmalloc is more general purpose than efence, so I'd suggst having a look at it.

Kurt



More information about the Linux-users mailing list