On Mon, Jun 18, 2012 at 09:38:15PM +0100, Ben Hutchings wrote: > On Mon, Jun 18, 2012 at 09:25:51PM +0100, Jamie White wrote: > > Hiya > > > > Just a quick question, which malloc, is there anyway that this > > function (used in C) could allocate memory into already allocated > > memory, such as the stack - or code space! > > Assuming that the program uses memory correctly, no. But if the > program has a bug that causes it to write to unallocated memory, it > could corrupt the memory allocator's state so that malloc later > returns memory that has already been allocated. valgrind is a wonderful tool for debugging this kind of errors. -- I was born an ugly, dumb and work-loving child, then an evil midwife replaced me in the crib.
Description: Digital signature