diff options
author | Gregory Maxwell <greg@xiph.org> | 2015-10-29 18:24:49 +0000 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2015-10-29 18:24:49 +0000 |
commit | 30d9662bd780e298516d514984ced1f88ec5bc3b (patch) | |
tree | a0836c96114e13b28dc4cbd46d4a3ef875212866 /src/wallet/walletdb.cpp | |
parent | 725539ea03769416d3502feeb4dfcbec3fbb7ae0 (diff) |
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).
Diffstat (limited to 'src/wallet/walletdb.cpp')
-rw-r--r-- | src/wallet/walletdb.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 0624e442d1..ea8a4eb043 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -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++; |