[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Malloc and security



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.

This isn't really on-topic for debian-devel, as it's a general C
language/library question.  Perhaps you should send further
questions to the comp.lang.c newsgroup, unless they're specific
to development of the Debian distribution.

Ben.

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus


Reply to: