Skip to content

Commit 48b5b84

Browse files
committed
Merge pull request #6906
30d9662 Reject invalid pubkeys when reading ckey items from the wallet. (Gregory Maxwell)
2 parents d482c0a + 30d9662 commit 48b5b84

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/wallet/walletdb.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,13 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
512512
}
513513
else if (strType == "ckey")
514514
{
515-
vector<unsigned char> vchPubKey;
515+
CPubKey vchPubKey;
516516
ssKey >> vchPubKey;
517+
if (!vchPubKey.IsValid())
518+
{
519+
strErr = "Error reading wallet database: CPubKey corrupt";
520+
return false;
521+
}
517522
vector<unsigned char> vchPrivKey;
518523
ssValue >> vchPrivKey;
519524
wss.nCKeys++;

0 commit comments

Comments
 (0)