From 3d91b22f14b0433a25c6c4a37218962b004f90d5 Mon Sep 17 00:00:00 2001 From: Baptistin BOILOT Date: Fri, 27 Dec 2024 16:49:02 +0100 Subject: [PATCH] fix: read of a uninitialized value in tx_info handlers --- src_features/generic_tx_parser/gtp_tx_info.c | 6 +++--- src_features/provideTrustedName/cmd_provide_trusted_name.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src_features/generic_tx_parser/gtp_tx_info.c b/src_features/generic_tx_parser/gtp_tx_info.c index 7913ab08d..bb523ff54 100644 --- a/src_features/generic_tx_parser/gtp_tx_info.c +++ b/src_features/generic_tx_parser/gtp_tx_info.c @@ -55,7 +55,7 @@ static bool handle_version(const s_tlv_data *data, s_tx_info_ctx *context) { static bool handle_chain_id(const s_tlv_data *data, s_tx_info_ctx *context) { uint64_t chain_id; - uint8_t buf[sizeof(chain_id)]; + uint8_t buf[sizeof(chain_id)] = {0}; if (data->length > sizeof(buf)) { return false; @@ -72,7 +72,7 @@ static bool handle_chain_id(const s_tlv_data *data, s_tx_info_ctx *context) { } static bool handle_contract_addr(const s_tlv_data *data, s_tx_info_ctx *context) { - uint8_t buf[ADDRESS_LENGTH]; + uint8_t buf[ADDRESS_LENGTH] = {0}; if (data->length > sizeof(buf)) { return false; @@ -165,7 +165,7 @@ static bool handle_contract_name(const s_tlv_data *data, s_tx_info_ctx *context) } static bool handle_deploy_date(const s_tlv_data *data, s_tx_info_ctx *context) { - uint8_t buf[sizeof(uint32_t)]; + uint8_t buf[sizeof(uint32_t)] = {0}; time_t timestamp; if (data->length > sizeof(buf)) { diff --git a/src_features/provideTrustedName/cmd_provide_trusted_name.c b/src_features/provideTrustedName/cmd_provide_trusted_name.c index a540c2369..d0015e973 100644 --- a/src_features/provideTrustedName/cmd_provide_trusted_name.c +++ b/src_features/provideTrustedName/cmd_provide_trusted_name.c @@ -822,7 +822,7 @@ static bool parse_tlv(const s_tlv_payload *payload, {.tag = NFT_ID, .func = &handle_nft_id}, }; e_tlv_step step = TLV_TAG; - s_tlv_data data; + s_tlv_data data = {0}; size_t offset = 0; size_t tag_start_off;