diff options
| author | Jeremy Rubin <[email protected]> | 2017-02-19 13:27:10 -0500 |
|---|---|---|
| committer | Jeremy Rubin <[email protected]> | 2017-07-08 13:31:47 -0700 |
| commit | 500710bd291e0b9f269ef20677a4a849fb76fc06 (patch) | |
| tree | 08d3fc711f6852fbbec03b97d544a74fc329dd06 /src | |
| parent | Fix subscript[0] bug in net.cpp if GetGroup returns a 0-sized vector (diff) | |
| download | discoin-500710bd291e0b9f269ef20677a4a849fb76fc06.tar.xz discoin-500710bd291e0b9f269ef20677a4a849fb76fc06.zip | |
Fix 2 subscript[0] bugs in pubkey.cpp, and eliminate one extra size check
Diffstat (limited to 'src')
| -rw-r--r-- | src/pubkey.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/pubkey.cpp b/src/pubkey.cpp index a16457ea4..91af4e56f 100644 --- a/src/pubkey.cpp +++ b/src/pubkey.cpp @@ -172,10 +172,7 @@ bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchS if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) { return false; } - if (vchSig.size() == 0) { - return false; - } - if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, &vchSig[0], vchSig.size())) { + if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, vchSig.data(), vchSig.size())) { return false; } /* libsecp256k1's ECDSA verification requires lower-S signatures, which have @@ -274,7 +271,7 @@ bool CExtPubKey::Derive(CExtPubKey &out, unsigned int _nChild) const { /* static */ bool CPubKey::CheckLowS(const std::vector<unsigned char>& vchSig) { secp256k1_ecdsa_signature sig; - if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, &vchSig[0], vchSig.size())) { + if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, vchSig.data(), vchSig.size())) { return false; } return (!secp256k1_ecdsa_signature_normalize(secp256k1_context_verify, NULL, &sig)); |