Skip to content

Commit

Permalink
Fix subscript[0] potential bugs in key.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRubin authored and furszy committed May 8, 2021
1 parent 8e2e79e commit c814967
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ CPrivKey CKey::GetPrivKey() const
size_t privkeylen;
privkey.resize(PRIVATE_KEY_SIZE);
privkeylen = PRIVATE_KEY_SIZE;
int ret = ec_privkey_export_der(secp256k1_context_sign, (unsigned char*)&privkey[0], &privkeylen, begin(), fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED);
int ret = ec_privkey_export_der(secp256k1_context_sign, (unsigned char*)privkey.data(), &privkeylen, begin(), fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED);
assert(ret);
privkey.resize(privkeylen);
return privkey;
Expand Down Expand Up @@ -306,7 +306,6 @@ void CExtKey::SetSeed(const unsigned char* seed, unsigned int nSeedLen)
CHMAC_SHA512(hashkey, sizeof(hashkey)).Write(seed, nSeedLen).Finalize(vout.data());
key.Set(vout.data(), vout.data() + 32, true);
memcpy(chaincode.begin(), vout.data() + 32, 32);

nDepth = 0;
nChild = 0;
memset(vchFingerprint, 0, sizeof(vchFingerprint));
Expand Down

0 comments on commit c814967

Please sign in to comment.