Browse Source

Reject invalid pubkeys when reading ckey items from the wallet.

This makes the behavior more consistent with key objects and will
 reject some corrupted pubkeys (e.g. zero length).
tags/v0.15.1
Gregory Maxwell 4 years ago
parent
commit
30d9662bd7
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      src/wallet/walletdb.cpp

+ 6
- 1
src/wallet/walletdb.cpp View File

@@ -512,8 +512,13 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
}
else if (strType == "ckey")
{
vector<unsigned char> vchPubKey;
CPubKey vchPubKey;
ssKey >> vchPubKey;
if (!vchPubKey.IsValid())
{
strErr = "Error reading wallet database: CPubKey corrupt";
return false;
}
vector<unsigned char> vchPrivKey;
ssValue >> vchPrivKey;
wss.nCKeys++;

Loading…
Cancel
Save