Use strlcpy instead of strncpy

This commit is contained in:
pscott
2021-07-27 12:23:55 +02:00
parent b7110eafe0
commit ee4a865144
4 changed files with 5 additions and 5 deletions

View File

@@ -10,7 +10,7 @@ bool copy_transaction_parameters(create_transaction_parameters_t* sign_transacti
// We need this "trick" as the input data position can overlap with app-ethereum globals
txStringProperties_t stack_data;
memset(&stack_data, 0, sizeof(stack_data));
strncpy(stack_data.fullAddress,
strlcpy(stack_data.fullAddress,
sign_transaction_params->destination_address,
sizeof(stack_data.fullAddress));
if ((stack_data.fullAddress[sizeof(stack_data.fullAddress) - 1] != '\0') ||

View File

@@ -93,7 +93,7 @@ bool uint256_to_decimal(const uint8_t *value, size_t value_len, char *out, size_
// Not enough space to hold "0" and \0.
return false;
}
strncpy(out, "0", out_len);
strlcpy(out, "0", out_len);
return true;
}