Add copy constructor to prevent undefined behaviour.
authorCryptoManiac <balthazar@yandex.ru>
Mon, 15 Feb 2016 18:23:11 +0000 (21:23 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Mon, 15 Feb 2016 18:23:11 +0000 (21:23 +0300)
src/key.h

index 1ce14f8..38ebe76 100644 (file)
--- a/src/key.h
+++ b/src/key.h
@@ -218,6 +218,12 @@ private:
 
 public:
     CMalleablePubKey() { nVersion = CMalleablePubKey::CURRENT_VERSION; }
+    CMalleablePubKey(const CMalleablePubKey& mpk)
+    {
+        nVersion = mpk.nVersion;
+        pubKeyL = mpk.pubKeyL;
+        pubKeyH = mpk.pubKeyH;
+    }
     CMalleablePubKey(const std::string& strMalleablePubKey) { SetString(strMalleablePubKey); }
     CMalleablePubKey(const CPubKey &pubKeyInL, const CPubKey &pubKeyInH) : pubKeyL(pubKeyInL), pubKeyH(pubKeyInH) { nVersion = CMalleablePubKey::CURRENT_VERSION; }
     CMalleablePubKey(const std::vector<unsigned char> &pubKeyInL, const std::vector<unsigned char> &pubKeyInH) : pubKeyL(pubKeyInL), pubKeyH(pubKeyInH) { nVersion = CMalleablePubKey::CURRENT_VERSION; }