mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Wallet: Sanitise -wallet parameter
This commit is contained in:
@@ -3765,6 +3765,12 @@ bool CWallet::InitLoadWallet()
|
||||
|
||||
std::string walletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
|
||||
|
||||
if (walletFile.find_first_of("/\\") != std::string::npos) {
|
||||
return InitError(_("-wallet parameter must only specify a filename (not a path)"));
|
||||
} else if (SanitizeString(walletFile, SAFE_CHARS_FILENAME) != walletFile) {
|
||||
return InitError(_("Invalid characters in -wallet filename"));
|
||||
}
|
||||
|
||||
CWallet * const pwallet = CreateWalletFromFile(walletFile);
|
||||
if (!pwallet) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user