Re: Stack growth direction to thwart buffer overflow attacks

From: Casper H.S. Dik (Casper.Dik_at_Sun.COM)
Date: 08/19/03


Date: 19 Aug 2003 15:04:30 GMT

Frank Cusack <fcusack@fcusack.com> writes:

>How utterly idiotic. strncat appends up to count characters, PLUS ONE.
>I don't have any reference handy (why is it always in "my other pants"?)
>but I'll be surprised if that's how the C99 strncat works.

It appends at most N characters; *not* "plus one"; the first appended
character overwrites the NUL terminator currently present.
(I..e, the minimal amount of storage required to hold the
string will increase with at most "n")

I'd be very surprised if C99 deviated from this defacto definition of
strncat().

Casper

-- 
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.