diff options
| author | MarcoFalke <[email protected]> | 2018-04-04 17:50:14 -0400 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2018-04-04 17:50:32 -0400 |
| commit | bfaed1ab2ec7fb3a1a6a7ed0b84503c2ed461c67 (patch) | |
| tree | 74246fee62fb82a37244ac1e59ed584c46975f58 /src/keystore.cpp | |
| parent | Merge #12853: qa: Match full plain text by default (diff) | |
| parent | Assert CPubKey::ValidLength to the pubkey's header-relevent size (diff) | |
| download | discoin-bfaed1ab2ec7fb3a1a6a7ed0b84503c2ed461c67.tar.xz discoin-bfaed1ab2ec7fb3a1a6a7ed0b84503c2ed461c67.zip | |
Merge #12460: Assert CPubKey::ValidLength to the pubkey's header-relevant size
f8c249ab91 Assert CPubKey::ValidLength to the pubkey's header-relevent size (Ben Woosley)
Pull request description:
A pubkey's length is specific to its type which is indicated by its header value. GetLen returns the header-indicated length, so this change ensures that a key matches its header-indicated length.
And replace some magic values with their constant equivalents.
Tree-SHA512: b727b39a631babe0932326396fc4d796ade8ec1e37454ff0c709ae9b78ecbd0cfdf59d84089ba8415e6efa7bc180e3cd39a14ddaf0871cbac54b96851e1b7b44
Diffstat (limited to 'src/keystore.cpp')
| -rw-r--r-- | src/keystore.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/keystore.cpp b/src/keystore.cpp index dfdfa5ea9..e69d51889 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -127,7 +127,7 @@ static bool ExtractPubKey(const CScript &dest, CPubKey& pubKeyOut) CScript::const_iterator pc = dest.begin(); opcodetype opcode; std::vector<unsigned char> vch; - if (!dest.GetOp(pc, opcode, vch) || vch.size() < 33 || vch.size() > 65) + if (!dest.GetOp(pc, opcode, vch) || !CPubKey::ValidSize(vch)) return false; pubKeyOut = CPubKey(vch); if (!pubKeyOut.IsFullyValid()) |