From: CryptoManiac Date: Wed, 1 Dec 2021 12:34:36 +0000 (+0300) Subject: Fix crash X-Git-Tag: nvc-v0.5.9~113 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=47fbd81219787fb8331663cf25fde163f87287b8 Fix crash --- diff --git a/src/bignum.h b/src/bignum.h index 3d5ec4b..3730b47 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -78,6 +78,15 @@ public: return (*this); } + CBigNum(const BIGNUM *bnp) { + BIGNUM *dup = BN_dup(bnp); + if (!dup) + { + throw bignum_error("CBigNum::CBigNum(const BIGNUM*) : BN_dup failed"); + } + bn = dup; + } + ~CBigNum() { BN_clear_free(bn); diff --git a/src/key.cpp b/src/key.cpp index 2f840ae..0aaa948 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -703,8 +703,7 @@ void CMalleablePubKey::GetVariant(CPubKey &R, CPubKey &vchPubKeyVariant) R = CPubKey(vchPubKey); // OpenSSL BIGNUM representation of r value - CBigNum bnr; - bnr = *(CBigNum*) EC_KEY_get0_private_key(eckey); + CBigNum bnr(EC_KEY_get0_private_key(eckey)); EC_KEY_free(eckey); CPoint point;