diff options
| author | practicalswift <[email protected]> | 2018-05-02 10:43:17 +0200 |
|---|---|---|
| committer | practicalswift <[email protected]> | 2018-05-02 10:43:17 +0200 |
| commit | 76f344de6d144e0a8169594836575a5812157327 (patch) | |
| tree | e80f4df89786628072dc33b14dc4f649b309afe7 /src | |
| parent | Merge #13141: [doc] qt: fixes broken link on readme (diff) | |
| download | discoin-76f344de6d144e0a8169594836575a5812157327.tar.xz discoin-76f344de6d144e0a8169594836575a5812157327.zip | |
logging: Fix potential use-after-free in LogPrintStr(...)
Diffstat (limited to 'src')
| -rw-r--r-- | src/logging.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/logging.cpp b/src/logging.cpp index 10a3b1895..604696937 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -222,8 +222,11 @@ int BCLog::Logger::LogPrintStr(const std::string &str) // reopen the log file, if requested if (m_reopen_file) { m_reopen_file = false; - if (fsbridge::freopen(m_file_path,"a",m_fileout) != nullptr) - setbuf(m_fileout, nullptr); // unbuffered + m_fileout = fsbridge::freopen(m_file_path, "a", m_fileout); + if (!m_fileout) { + return ret; + } + setbuf(m_fileout, nullptr); // unbuffered } ret = FileWriteStr(strTimestamped, m_fileout); |