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:
committed by
pscott
parent
c27d59d792
commit
cd78581ffd
@@ -94,7 +94,9 @@ eth_plugin_result_t eth_plugin_perform_init(uint8_t *contractAddress,
|
||||
if (memcmp(init->selector, (const void *) PIC(selectors[j]), SELECTOR_SIZE) == 0) {
|
||||
if ((INTERNAL_ETH_PLUGINS[i].availableCheck == NULL) ||
|
||||
((PluginAvailableCheck) PIC(INTERNAL_ETH_PLUGINS[i].availableCheck))()) {
|
||||
strcpy(dataContext.tokenContext.pluginName, INTERNAL_ETH_PLUGINS[i].alias);
|
||||
strlcpy(dataContext.tokenContext.pluginName,
|
||||
INTERNAL_ETH_PLUGINS[i].alias,
|
||||
PLUGIN_ID_LENGTH);
|
||||
dataContext.tokenContext.pluginStatus = ETH_PLUGIN_RESULT_OK;
|
||||
contractAddress = NULL;
|
||||
break;
|
||||
|
||||
@@ -36,7 +36,7 @@ bool copy_transaction_parameters(create_transaction_parameters_t* sign_transacti
|
||||
sizeof(stack_data.fullAmount));
|
||||
|
||||
// If the amount is a fee, its value is nominated in ETH even if we're doing an ERC20 swap
|
||||
strcpy(ticker, config->coinName);
|
||||
strlcpy(ticker, config->coinName, MAX_TICKER_LEN);
|
||||
decimals = WEI_TO_ETHER;
|
||||
amountToString(sign_transaction_params->fee_amount,
|
||||
sign_transaction_params->fee_amount_length,
|
||||
|
||||
@@ -81,7 +81,7 @@ void stark_get_amount_string(uint8_t *contractAddress,
|
||||
mul256(&amountPre, &quantum, &amount);
|
||||
tostring256(&amount, 10, tmp100, 100);
|
||||
PRINTF("stark_get_amount_string - mul256 %s\n", tmp100);
|
||||
strcpy(target100, ticker);
|
||||
strlcpy(target100, ticker, 100);
|
||||
adjustDecimals(tmp100, strlen(tmp100), target100 + strlen(ticker), 100, decimals);
|
||||
PRINTF("get_amount_string %s\n", target100);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ typedef struct tokenDefinition_t {
|
||||
uint8_t contractName[ADDRESS_LENGTH];
|
||||
#endif
|
||||
uint8_t address[ADDRESS_LENGTH];
|
||||
uint8_t ticker[MAX_TICKER_LEN];
|
||||
char ticker[MAX_TICKER_LEN];
|
||||
uint8_t decimals;
|
||||
} tokenDefinition_t;
|
||||
|
||||
|
||||
@@ -132,11 +132,13 @@ UX_FLOW(ux_settings_flow,
|
||||
&ux_settings_flow_4_step);
|
||||
|
||||
void display_settings(const ux_flow_step_t* const start_step) {
|
||||
strcpy(strings.common.fullAddress, (N_storage.dataAllowed ? "Allowed" : "NOT Allowed"));
|
||||
strcpy(strings.common.fullAddress + 12,
|
||||
(N_storage.contractDetails ? "Displayed" : "NOT Displayed"));
|
||||
strcpy(strings.common.fullAddress + 26,
|
||||
(N_storage.displayNonce ? "Displayed" : "NOT Displayed"));
|
||||
strlcpy(strings.common.fullAddress, (N_storage.dataAllowed ? "Allowed" : "NOT Allowed"), 12);
|
||||
strlcpy(strings.common.fullAddress + 12,
|
||||
(N_storage.contractDetails ? "Displayed" : "NOT Displayed"),
|
||||
26 - 12);
|
||||
strlcpy(strings.common.fullAddress + 26,
|
||||
(N_storage.displayNonce ? "Displayed" : "NOT Displayed"),
|
||||
sizeof(strings.common.fullAddress) - 26);
|
||||
ux_flow_init(0, ux_settings_flow, start_step);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user