X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b568d04ffa191f9e3b643ca33526094eca0ba304..f151e8b583e949687fc91e6848dae943de0172ec:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 280e105f25..fe8480cd45 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -203,7 +203,10 @@ extern int WXDLLEXPORT wxVsnprintf(wxChar *buf, size_t len, // vsnprintf() will not terminate the string with '\0' if there is not // enough place, but we want the string to always be NUL terminated int rc = wxVsnprintfA(buf, len - 1, format, argptr); - buf[len] = 0; + if ( rc == -1 ) + { + buf[len] = 0; + } return rc; #endif // Unicode/ANSI