Re: [Code] Strange error.

From: The Fungi (fungi@yuggoth.org)
Date: 01/10/03


On Sat, Jan 11, 2003 at 01:09:02AM +0100, Thomas Arp wrote:
[...]
> Putting in an assert() would be pointless, unless you're doing some
> manual additions beside the snprintf().

This was suggested more to catch misuse of string functions. I
don't do it personally, but it could be helpful in avoiding
accidental overflows where you forgot to sNprintf() and just used an
sprintf() call instead. Belt and suspenders.

> Making further structs is only necessary if you wish the buffer to
> be inherited into the functions below it, and only then if you don't
> wish to add a size_t argument to the function.
[...]

Again, mostly useful to keep sharp objects away from dangerous
developers when coupled with strict use of wrapper functions to add
to and read from checked_string instances, reducing the chances of a
less savvy coworker introducing arbitrary buffer overflows. It's
bloat, granted, and I wouldn't bother in code where I was the only
one touching things. Of course, you could argue that coders
frequently making these sorts of mistakes shouldn't be messing with
C in the first place (or any other language lacking real strings).

But you're right. Probably useless for the situation at hand...
--
{ IRL(Jeremy_Stanley); PGP(9E8DFF2E4F5995F8FEADDC5829ABF7441FB84657);
SMTP(fungi@yuggoth.org); IRC(fungi@irc.yuggoth.org#ccl); ICQ(114362511);
AIM(dreadazathoth); YAHOO(crawlingchaoslabs); FINGER(fungi@yuggoth.org);
MUD(Nergel@srmud.net:2325); WWW(http://fungi.yuggoth.org/); }

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/26/03 PDT