Bug 1239941 - Copy va_list before using it in LogModuleManager::Print. r=froydnj

This commit is contained in:
Eric Rahm 2016-01-15 10:14:26 -08:00
parent dce0f0ba3b
commit 08ccc26741

View File

@ -145,7 +145,11 @@ public:
// For backwards compat we need to use the NSPR format string versions
// of sprintf and friends and then hand off to printf.
size_t charsWritten = PR_vsnprintf(buff, kBuffSize, aFmt, aArgs);
va_list argsCopy;
va_copy(argsCopy, aArgs);
size_t charsWritten = PR_vsnprintf(buff, kBuffSize, aFmt, argsCopy);
va_end(argsCopy);
if (charsWritten == kBuffSize - 1) {
// We may have maxed out, allocate a buffer instead.
buffToWrite = PR_vsmprintf(aFmt, aArgs);