[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070315220023.GA1618@localhost.localdomain>
Date: Thu, 15 Mar 2007 23:00:23 +0100
From: Ulf Harnhammar <metaur@...ia.com>
To: full-disclosure@...ts.grok.org.uk
Subject: Re: Python 2.5 (Modules/zlib) minigzip local
buffer overflow vulnerability
> Using strncpy is just strcpy + strlen
> anyway it can't have a big speed impact or anything.
That's not really true. If you check the Linux manpage for strncpy(3),
it says:
char *strncpy(char *dest, const char *src, size_t n);
[blah]
In the case where the length of src is less than that of n, the remain-
der of dest will be padded with null bytes.
"The C Programming Language" agrees:
"Pad with '\0's if t has fewer than n characters."
Thus, replacing strcpy(3) calls with strncpy(3) can have definite
impacts on performance.
Regards, Ulf Harnhammar
_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/
Powered by blists - more mailing lists