Game Development Community

1.5 - dsprintf assertion failure

by Guy Allard · in Torque Game Engine · 10/25/2006 (7:42 am) · 1 replies

I'm getting an assertfatal with dsprintf.

This is happening when I try to write, for example, 18 characters into an 18 character buffer.

I notice there's a new assertion added at line 301 of winStrings.cc that reads:

AssertFatal( len < bufferSize, "dSprintf wrote to more memory than the specified buffer size - Stack Corruption Possible" ); //Added

should the '<' not be a '<=' ??

(if I change the buffer size to 19 and write 18 chars to it, it's fine);

#1
10/25/2006 (7:47 am)
If you're writing a null-terminated string (which "character buffer" seems to imply), the null isn't counted as part of the string's length, but it would be copied with a sprintf call. Maybe that's what you're seeing?