From d86cd4f511e893ed88cb423f3a1768e51b039801 Mon Sep 17 00:00:00 2001 From: furszy Date: Tue, 15 Jun 2021 20:07:19 -0300 Subject: [PATCH] wallet: Add missing check for backup to source wallet file. --- src/wallet/db.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index e715a45bb28b0..c547df0e38455 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -767,6 +767,11 @@ bool CWalletDBWrapper::Backup(const std::string& strDest) pathDest /= strFile; try { + if (fs::equivalent(pathSrc, pathDest)) { + LogPrintf("cannot backup to wallet source file %s\n", pathDest.string()); + return false; + } + #if BOOST_VERSION >= 107400 fs::copy_file(pathSrc.c_str(), pathDest, fs::copy_options::overwrite_existing); #elif BOOST_VERSION >= 105800 /* BOOST_LIB_VERSION 1_58 */