Vulnerability Development mailing list archives

Re: Secure coding in C (was Re: Administrivia #4883)


From: valery () LINUX HOME BG (Valery Dachev)
Date: Mon, 17 Jan 2000 11:25:20 +0200


On Sun, 16 Jan 2000, spin0ff wrote:
both strlen call will return when they encounter a \0, implying that after
the third line, len will be long enough to hold a, b and the garbage
following both a and b. c will be large enough to hold all of this.

Lucky you ! You have encountered the \0 symbol after your buffer and
before the end of the segment. Take a look at the situation where the \0
symbol is not there. Your program can explode with "Segmentation
fault" (or "Segmentation violation" in Windows). There's a simple example
in the attachment.
Bye.

..........................................................................
:Name    : Valery Dachev        :Organization: Linux Society of Bulgaria :
:E-Mail  : valery () linux home bg :E-Mail      : info () linux home bg        :
:Homepage: --- none ---         :Homepage    : http://linux.home.bg      :
:........:......................:............:...........................:

<HR NOSHADE>
<UL>
<LI>TEXT/PLAIN attachment: Say 'BooM' !
</UL>


Current thread: