Skip to content

Commit 69d4ec5

Browse files
authored
Fixed build issues with uninitialized local variables. (#72)
1 parent 6552d3f commit 69d4ec5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/crypto/crypto_provider/crypto_provider_impl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ namespace libp2p::crypto {
325325
outcome::result<EphemeralKeyPair>
326326
CryptoProviderImpl::generateEphemeralKeyPair(common::CurveType curve) const {
327327
const auto FAILED{KeyGeneratorError::KEY_GENERATION_FAILED};
328-
int nid;
329-
size_t private_key_length_in_bytes;
328+
int nid = 0;
329+
size_t private_key_length_in_bytes = 0;
330330
switch (curve) {
331331
case common::CurveType::P256:
332332
nid = NID_X9_62_prime256v1;
@@ -536,8 +536,8 @@ namespace libp2p::crypto {
536536
CryptoProviderImpl::stretchKey(common::CipherType cipher_type,
537537
common::HashType hash_type,
538538
const Buffer &secret) const {
539-
size_t cipher_key_size;
540-
size_t iv_size;
539+
size_t cipher_key_size = 0;
540+
size_t iv_size = 0;
541541
switch (cipher_type) {
542542
case common::CipherType::AES128:
543543
cipher_key_size = 16;

src/crypto/rsa_provider/rsa_provider_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ namespace libp2p::crypto::rsa {
132132
OUTCOME_TRY(rsa, rsaFromPrivateKey(private_key));
133133
Hash256 digest = sha256(message);
134134
Signature signature(RSA_size(rsa.get()));
135-
unsigned int signature_size;
135+
unsigned int signature_size = 0;
136136
if (1
137137
!= RSA_sign(NID_sha256, digest.data(), digest.size(), signature.data(),
138138
&signature_size, rsa.get())) {

src/protocol/kademlia/impl/kad_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ namespace libp2p::protocol::kademlia {
441441
};
442442

443443
void KadImpl::getValue(const ContentAddress &key, GetValueResultFunc f) {
444-
LocalValueStore::AbsTime ts;
444+
LocalValueStore::AbsTime ts = 0;
445445
auto res = local_store_->getValue(key, ts);
446446
if (res) {
447447
// TODO(artem): subscriptions instead of coarse callback API

0 commit comments

Comments
 (0)