Fix all the defects identified by Clang Static Analyzer

Some fixes are dirty, but it is a start to enforce scan-build on
every commit.

Signed-off-by: pscott <scott.piriou@ledger.fr>
This commit is contained in:
Jean-Baptiste Bédrune
2021-07-16 12:04:39 +02:00
committed by pscott
parent c27d59d792
commit cd78581ffd
15 changed files with 158 additions and 144 deletions

View File

@@ -135,7 +135,7 @@ void eth2_plugin_call(int message, void *parameters) {
msg->pluginSharedRW->sha3);
// Copy back the string to the global variable.
strcpy(context->deposit_address, tmp);
strlcpy(context->deposit_address, tmp, ETH2_DEPOSIT_PUBKEY_LENGTH);
msg->result = ETH_PLUGIN_RESULT_OK;
break;
}
@@ -198,8 +198,8 @@ void eth2_plugin_call(int message, void *parameters) {
case ETH_PLUGIN_QUERY_CONTRACT_ID: {
ethQueryContractID_t *msg = (ethQueryContractID_t *) parameters;
strcpy(msg->name, "ETH2");
strcpy(msg->version, "Deposit");
strlcpy(msg->name, "ETH2", msg->nameLength);
strlcpy(msg->version, "Deposit", msg->versionLength);
msg->result = ETH_PLUGIN_RESULT_OK;
} break;
@@ -210,7 +210,7 @@ void eth2_plugin_call(int message, void *parameters) {
case 0: { // Amount screen
uint8_t decimals = WEI_TO_ETHER;
char *ticker = chainConfig->coinName;
strcpy(msg->title, "Amount");
strlcpy(msg->title, "Amount", msg->titleLength);
amountToString(tmpContent.txContent.value.value,
tmpContent.txContent.value.length,
decimals,
@@ -220,8 +220,8 @@ void eth2_plugin_call(int message, void *parameters) {
msg->result = ETH_PLUGIN_RESULT_OK;
} break;
case 1: { // Deposit pubkey screen
strcpy(msg->title, "Validator");
strcpy(msg->msg, context->deposit_address);
strlcpy(msg->title, "Validator", msg->titleLength);
strlcpy(msg->msg, context->deposit_address, msg->msgLength);
msg->result = ETH_PLUGIN_RESULT_OK;
}
default: