diff options
| author | Gregory Maxwell <[email protected]> | 2015-10-29 18:24:49 +0000 |
|---|---|---|
| committer | Gregory Maxwell <[email protected]> | 2015-10-29 18:24:49 +0000 |
| commit | 30d9662bd780e298516d514984ced1f88ec5bc3b (patch) | |
| tree | a0836c96114e13b28dc4cbd46d4a3ef875212866 | |
| parent | Merge pull request #6863 (diff) | |
| download | discoin-30d9662bd780e298516d514984ced1f88ec5bc3b.tar.xz discoin-30d9662bd780e298516d514984ced1f88ec5bc3b.zip | |
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).
| -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 0624e442d..ea8a4eb04 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++; |