vsnprintf isn't always guaranteed to null terminate its output, depends on the version of msvcrt used.
See !8256 for more information.
supersedes !8256
From: Yuxuan Shui yshui@codeweavers.com
vsnprintf isn't always guaranteed to null terminate its output, depends on the version of msvcrt used.
See !8256 for more information. --- include/wine/debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/wine/debug.h b/include/wine/debug.h index 3e0912de801..4ab49dfcb20 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -133,8 +133,8 @@ static const char * __wine_dbg_cdecl wine_dbg_vsprintf( const char *format, va_l static inline const char * __wine_dbg_cdecl wine_dbg_vsprintf( const char *format, va_list args ) { char buffer[200]; - - vsnprintf( buffer, sizeof(buffer), format, args ); + int len = vsnprintf( buffer, sizeof(buffer), format, args ); + if (len >= sizeof(buffer)) buffer[sizeof(buffer) - 1] = 0; return __wine_dbg_strdup( buffer ); }