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 vchPubKey; + CPubKey vchPubKey; ssKey >> vchPubKey; + if (!vchPubKey.IsValid()) + { + strErr = "Error reading wallet database: CPubKey corrupt"; + return false; + } vector vchPrivKey; ssValue >> vchPrivKey; wss.nCKeys++;