[4968] in bugtraq
Re: better snprintf replacement, anyone?
daemon@ATHENA.MIT.EDU (Alan Cox)
Tue Jul 22 10:10:59 1997
Date: Tue, 22 Jul 1997 09:36:35 +0100
Reply-To: Alan Cox <alan@LXORGUK.UKUU.ORG.UK>
From: Alan Cox <alan@LXORGUK.UKUU.ORG.UK>
X-To: scoile@PATRIOT.NET
To: BUGTRAQ@NETSPACE.ORG
In-Reply-To: <Pine.LNX.3.95.970721075858.1464C-100000@adams.patriot.net> from
"Steve \"Stevers!\" Coile" at Jul 21, 97 08:05:34 am
> you have a large enough buffer, you eliminate the buffer overflow problem,
> and you don't truncate the string. Is malloc()-ing the memory *that*
> inefficient? Less efficient than the scanning and parsing snprintf()
> must do to the format string?
In the case of a dynamic loader you don't have a libc backing you, thats
why someone took the (very wrong) shortcut they did originally when doing
ld.so
You are right about malloc for many cases, but its also true that you
normally know the length of a buffer anyway