Re: [SYSTEM-WIN95] borland, sprintf, autoexit

From: Angus Mezick (angus@EDGIL.CCMAIL.COMPUSERVE.COM)
Date: 12/15/97


     hmmm... I seen this problem on an SGI indy and a Sun box.  Started
     right after I added the buffer patch....  is really odd...
     --Angus

     P.S.  If anyone else out there is using purify on the source or any
     patches, post your results.  I am just glad I have only found slow
     leaks so far.  the worst right now is one with the oasis and mobprog
     structs not being freed.


______________________________ Forward Header __________________________________
Subject: Re:  [SYSTEM-WIN95] borland, sprintf, autoexit
Author:  INTERNET:CIRCLE@post.queensu.ca at CSERVE
Date:    12/15/97 1:36 PM

>On Sat, 13 Dec 1997, Kingmundi wrote:
>
>> sprintf(buf, "%s %s ", buf, dirs[door]);
>> send_to_char(buf, ch);
>
>The above code produces undefined results. You have no guarantee that
>sprintf will read its arguments before it starts doing something to the
>output buffer. In theory, the compiler writer is allowed to blow up your
>computer when encountering such code. Unfortunately, few choose to do so

That would probably result because Borland decides to NUL the buffer before
beginning the copy.  Every other system I've seen will just copy the string
on top of itself causing the desired behavior.

Ah well...something to do for a future pl.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST