If two threads call vssprintf at the same time, it is possible for bInitialized to be set before actually setting bExactSizeSupported. Set bInitialized after setting bExactSizeSupported to avoid this.

This commit is contained in:
Steve Checkoway
2007-05-06 17:59:11 +00:00
parent c8c9a14507
commit c5fb5593ac
+1 -1
View File
@@ -318,9 +318,9 @@ RString vssprintf( const char *szFormat, va_list argList )
/* Some systems return the actual size required when snprintf
* doesn't have enough space. This lets us avoid wasting time
* iterating, and wasting memory. */
bInitialized = true;
char ignore;
bExactSizeSupported = ( snprintf( &ignore, 0, "Hello World" ) == 11 );
bInitialized = true;
}
if( bExactSizeSupported )