Skip to content

Commit c814967

Browse files
JeremyRubinfurszy
authored andcommitted
Fix subscript[0] potential bugs in key.cpp
1 parent 8e2e79e commit c814967

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/key.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ CPrivKey CKey::GetPrivKey() const
189189
size_t privkeylen;
190190
privkey.resize(PRIVATE_KEY_SIZE);
191191
privkeylen = PRIVATE_KEY_SIZE;
192-
int ret = ec_privkey_export_der(secp256k1_context_sign, (unsigned char*)&privkey[0], &privkeylen, begin(), fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED);
192+
int ret = ec_privkey_export_der(secp256k1_context_sign, (unsigned char*)privkey.data(), &privkeylen, begin(), fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED);
193193
assert(ret);
194194
privkey.resize(privkeylen);
195195
return privkey;
@@ -306,7 +306,6 @@ void CExtKey::SetSeed(const unsigned char* seed, unsigned int nSeedLen)
306306
CHMAC_SHA512(hashkey, sizeof(hashkey)).Write(seed, nSeedLen).Finalize(vout.data());
307307
key.Set(vout.data(), vout.data() + 32, true);
308308
memcpy(chaincode.begin(), vout.data() + 32, 32);
309-
310309
nDepth = 0;
311310
nChild = 0;
312311
memset(vchFingerprint, 0, sizeof(vchFingerprint));

0 commit comments

Comments
 (0)