Vanilla List Maling List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [VANILLA-LIST:2200] Ouch



Bob Tanner wrote:
> Well, I thought the hand coded string utils would be just as good of a
> solution as snprintf().

Different purposes.  sprintf() is both a performance problem and a risk
of stack and heap corruption if coded wrongly.  snprintf() only fixes
the corruption issue a bit.  It does nothing for the performance issue.

I personally don't think it is worth recoding to avoid sprintf for
performance ... the server consumes negligible CPU.

However, cleaning it to use snprintf(), while valuable in removing
potential present and future defects, would not be portable to as many
operating systems.

So adopting string_util.c from COW might have a useful effect.

-- 
James Cameron                                      (cameron@stl.dec.com)

OpenVMS, Linux, Firewalls, Software Engineering, CGI, HTTP, X, C, FORTH,
COBOL, BASIC, DCL, csh, bash, ksh, sh, Electronics, Microcontrollers,
Disability Engineering, Netrek, Bicycles, Pedant, Farming, Home Control,
Remote Area Power, Greek Scholar, Tenor Vocalist, Church Sound, Husband.

"Specialisation is for insects." -- Robert Heinlein.