Re: Buffer Overflow
From: Juha Laiho (Juha.Laiho@iki.fi)
Date: 04/05/03
- Next message: eminemTR: "how to run at reboot?"
- Previous message: Marc Rochkind: "Re: fdopen replacement"
- In reply to: Alan Balmer: "Re: Buffer Overflow"
- Next in thread: Sam Hocevar: "Re: Buffer Overflow"
- Reply: Sam Hocevar: "Re: Buffer Overflow"
- Reply: Absolute Newbie: "Re: Buffer Overflow"
- Reply: Bjorn Reese: "Re: Buffer Overflow"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: Juha Laiho <Juha.Laiho@iki.fi> Date: Sat, 05 Apr 2003 19:22:00 GMT
albalmer@spamcop.net said:
>On 4 Apr 2003 13:56:45 -0800, raphael_77@yahoo.com (Jack) wrote:
>>Hey Guys I need your point of view in terms of buffer overflow. These
>>are the steps i take while transfering data from one socket to the
>>other.
>>1) The first 2 bytes of the message tell me the length of the buffer.
>>2) I malloc my buffer for that size, memset the buffer
>>3) If the data size increases my MAX_LIMIT i disregard the message.
>>
>Presumably you're going to copy or read the message into the allocated
>buffer, so there's no need to memset it.
I've been bitten by this - and there is a need to zero the buffer you get
from malloc(): while the OS memory allocation routines will clear (to
some value; I think the actual value hasn't been specified) the memory
areas they're giving to your process, malloc() may also return memory
that was already used by your process, but free()'d (but still not yet
returned to the OS). And in this case the contents will not be scrubbed;
the memory will contain whatever it did contain when your program freed
the area.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
- Next message: eminemTR: "how to run at reboot?"
- Previous message: Marc Rochkind: "Re: fdopen replacement"
- In reply to: Alan Balmer: "Re: Buffer Overflow"
- Next in thread: Sam Hocevar: "Re: Buffer Overflow"
- Reply: Sam Hocevar: "Re: Buffer Overflow"
- Reply: Absolute Newbie: "Re: Buffer Overflow"
- Reply: Bjorn Reese: "Re: Buffer Overflow"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|