@>-----Original Message-----
@>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf 
@>Of brian moore
@>Sent: Monday, September 09, 2002 5:51 PM
@>To: [email protected]
@>Subject: Re: Memory, Buffers, format_string and room descriptions....
@> @> @>How is string_buf defined?  Does it need freeing or is it a 
@>dynamic variable (ie, "char string_buf[MAX_STRING_LENGTH];") @>

It is defined as:

char string_buf[MSL];

@>
@>You understand wrong.  "Out of bounds" has nothing to do with 
@>the size of the string.

Heh.  OK. I appreciate your bluntness.

@>
@>It has -everything- to do with the fact that 0x8593 is not a 
@>valid pointer.
@>
@>Your bug almost certainly lies in 'format_string()', or your 
@>understanding of how to use it and how it should behave.
@>
@>format_string() is not passed enough information to do things 
@>correctly in all cases: if it has to make a string longer 
@>than what it was given (ie, it has to insert line breaks), it 
@>will overwrite anything that happens to be after your 
@>string.. corrupting anything that was there.
@>
@>It -could-, if you passed it a reference to a pointer (ie, called it
@>like: format_string(&pRoom->wild_desc), free what it was 
@>given and point to the new string... but you would have to 
@>rewrite the function to handle that.
@>
@>Or, it could be written to return a pointer to its own static 
@>buffer, holding the last string it parsed... but, again, you 
@>would have to rewrite it to do that.
@>

Could you give maybe a brief example of those two cases or point me to
where I could locate this info on my own?  No problem rewriting the
function if necessary.   I'm looking for utmost reliability, which I
think we all pretty much are.

Vert
RoL


Reply via email to