aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGavin Andresen <[email protected]>2013-10-30 01:03:25 -0700
committerGavin Andresen <[email protected]>2013-10-30 01:03:25 -0700
commit42a12f22d6b644fcd879da23f6e56c310eb9985f (patch)
tree2af6e7b4c855d896fc090cb476105a73079a0b2e /src
parentMerge pull request #3173 from gavinandresen/fuzzmessages (diff)
parentfix wrong memcmp() usage in CKey::operator== (diff)
downloaddiscoin-42a12f22d6b644fcd879da23f6e56c310eb9985f.tar.xz
discoin-42a12f22d6b644fcd879da23f6e56c310eb9985f.zip
Merge pull request #3176 from Diapolo/key
fix wrong memcmp() usage in CKey::operator==
Diffstat (limited to 'src')
-rw-r--r--src/key.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/key.h b/src/key.h
index ac050356f..bbe64d668 100644
--- a/src/key.h
+++ b/src/key.h
@@ -205,7 +205,8 @@ public:
}
friend bool operator==(const CKey &a, const CKey &b) {
- return a.fCompressed == b.fCompressed && memcmp(&a.vch[0], &b.vch[0], 32);
+ return a.fCompressed == b.fCompressed && a.size() == b.size() &&
+ memcmp(&a.vch[0], &b.vch[0], a.size()) == 0;
}
// Initialize using begin and end iterators to byte data.
@@ -261,9 +262,9 @@ public:
// Derive BIP32 child key.
bool Derive(CKey& keyChild, unsigned char ccChild[32], unsigned int nChild, const unsigned char cc[32]) const;
-
+
// Load private key and check that public key matches.
- bool Load(CPrivKey &privkey, CPubKey &vchPubKey, bool fSkipCheck);
+ bool Load(CPrivKey &privkey, CPubKey &vchPubKey, bool fSkipCheck);
};
struct CExtPubKey {