1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-20 01:03:16 +03:00

Fix use-after-free in wsrep::log

This commit is contained in:
Denis Protivensky
2023-10-17 13:53:11 +03:00
parent 07af42c052
commit ffe1ba7a5d

View File

@ -86,7 +86,11 @@ namespace wsrep
{
if (logger_fn_)
{
logger_fn_(level_, prefix_, oss_.str().c_str());
// Prolong the lifetime of the string so it doesn't get
// destroyed right after evaluating c_str() and before
// completing the logger function call.
const std::string& tmp = oss_.str();
logger_fn_(level_, prefix_, tmp.c_str());
}
else
{