aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-10-31 00:39:45 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-10-31 00:39:50 +0100
commit48b5b84ee511d5ccd0d47bb0018c1b3c9ddebeff (patch)
treec41db909f64474f51a2210cfec2a67f7f5dde062
parentd482c0a7b246aa935595678a0c0e2f5ad530665b (diff)
parent30d9662bd780e298516d514984ced1f88ec5bc3b (diff)
Merge pull request #6906
30d9662 Reject invalid pubkeys when reading ckey items from the wallet. (Gregory Maxwell)
-rw-r--r--src/wallet/walletdb.cpp7
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++;