mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-22 05:45:38 +00:00
fix segfault in CMultiLogger
vsprintf may change its va_list argument so repeatedly calling it with the same va_list arg is undefined behavior. Fix this by creating a copy of the va_list argument before each vsprintf call.
This commit is contained in:
parent
e59ecea32d
commit
1bb7de1dd9
|
@ -168,7 +168,10 @@ void CMultiLogger::DebugLog(const char *fmt, va_list vl)
|
|||
{
|
||||
for (auto &logger: m_loggers)
|
||||
{
|
||||
logger->DebugLog(fmt, vl);
|
||||
va_list vl_tmp;
|
||||
va_copy(vl_tmp, vl);
|
||||
logger->DebugLog(fmt, vl_tmp);
|
||||
va_end(vl_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,7 +179,10 @@ void CMultiLogger::InfoLog(const char *fmt, va_list vl)
|
|||
{
|
||||
for (auto &logger: m_loggers)
|
||||
{
|
||||
logger->InfoLog(fmt, vl);
|
||||
va_list vl_tmp;
|
||||
va_copy(vl_tmp, vl);
|
||||
logger->InfoLog(fmt, vl_tmp);
|
||||
va_end(vl_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,7 +190,10 @@ void CMultiLogger::ErrorLog(const char *fmt, va_list vl)
|
|||
{
|
||||
for (auto &logger: m_loggers)
|
||||
{
|
||||
logger->ErrorLog(fmt, vl);
|
||||
va_list vl_tmp;
|
||||
va_copy(vl_tmp, vl);
|
||||
logger->ErrorLog(fmt, vl_tmp);
|
||||
va_end(vl_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue