diff --git a/src/eth_plugin_interface.h b/src/eth_plugin_interface.h index 5bf54992a1..669b060bb5 100644 --- a/src/eth_plugin_interface.h +++ b/src/eth_plugin_interface.h @@ -14,7 +14,7 @@ typedef enum { ETH_PLUGIN_INTERFACE_VERSION_3 = 3, ETH_PLUGIN_INTERFACE_VERSION_4 = 4, ETH_PLUGIN_INTERFACE_VERSION_5 = 5, - ETH_PLUGIN_INTERFACE_VERSION_LATEST = 6 + ETH_PLUGIN_INTERFACE_VERSION_LATEST = 6, } eth_plugin_interface_version_t; typedef enum { @@ -25,7 +25,7 @@ typedef enum { ETH_PLUGIN_PROVIDE_INFO = 0x0104, ETH_PLUGIN_QUERY_CONTRACT_ID = 0x0105, ETH_PLUGIN_QUERY_CONTRACT_UI = 0x0106, - ETH_PLUGIN_CHECK_PRESENCE = 0x01FF + ETH_PLUGIN_CHECK_PRESENCE = 0x01FF, } eth_plugin_msg_t; @@ -39,14 +39,14 @@ typedef enum { ETH_PLUGIN_RESULT_SUCCESSFUL = 0x03, // Used for comparison ETH_PLUGIN_RESULT_OK = 0x04, ETH_PLUGIN_RESULT_OK_ALIAS = 0x05, - ETH_PLUGIN_RESULT_FALLBACK = 0x06 + ETH_PLUGIN_RESULT_FALLBACK = 0x06, } eth_plugin_result_t; typedef enum { ETH_UI_TYPE_AMOUNT_ADDRESS = 0x01, - ETH_UI_TYPE_GENERIC = 0x02 + ETH_UI_TYPE_GENERIC = 0x02, } eth_ui_type_t; diff --git a/src_features/provideDomainName/cmd_provide_domain_name.c b/src_features/provideDomainName/cmd_provide_domain_name.c index e1d14a49c6..51e9daca8c 100644 --- a/src_features/provideDomainName/cmd_provide_domain_name.c +++ b/src_features/provideDomainName/cmd_provide_domain_name.c @@ -205,10 +205,13 @@ static bool handle_challenge(const s_tlv_data *data, s_domain_name_info *domain_name_info, s_sig_ctx *sig_ctx) { uint32_t value; - (void) domain_name_info; (void) sig_ctx; - return get_uint_from_data(data, &value) && (value == get_challenge()); + + if (!get_uint_from_data(data, &value)) { + return false; + } + return (value == get_challenge()); } /** @@ -223,8 +226,8 @@ static bool handle_sign_key_id(const s_tlv_data *data, s_domain_name_info *domain_name_info, s_sig_ctx *sig_ctx) { uint32_t value; - (void) domain_name_info; + if (!get_uint_from_data(data, &value) || (value > UINT8_MAX)) { return false; } @@ -247,7 +250,10 @@ static bool handle_sign_algo(const s_tlv_data *data, (void) domain_name_info; (void) sig_ctx; - return get_uint_from_data(data, &value) && (value == ALGO_SECP256K1); + if (!get_uint_from_data(data, &value)) { + return false; + } + return (value == ALGO_SECP256K1); } /** @@ -338,7 +344,10 @@ static bool handle_coin_type(const s_tlv_data *data, (void) domain_name_info; (void) sig_ctx; - return get_uint_from_data(data, &value) && (value == SLIP_44_ETHEREUM); + if (!get_uint_from_data(data, &value)) { + return false; + } + return (value == SLIP_44_ETHEREUM); } /**