use size_t instead of uint8_t to prevent potential integer overflows

This commit is contained in:
greenknot
2022-01-20 09:35:02 +01:00
parent 3c36c41d3e
commit 6c03be385c
2 changed files with 6 additions and 6 deletions

View File

@@ -73,7 +73,7 @@ void handleProvideNFTInformation(uint8_t p1,
PRINTF("Provisioning currentItemIndex %d\n", tmpCtx.transactionContext.currentItemIndex);
uint8_t offset = 0;
size_t offset = 0;
if (dataLength <= HEADER_SIZE) {
PRINTF("Data too small for headers: expected at least %d, got %d\n",
@@ -108,8 +108,8 @@ void handleProvideNFTInformation(uint8_t p1,
offset += NAME_LENGTH_SIZE;
// Size of the payload (everything except the signature)
uint8_t payloadSize = HEADER_SIZE + collectionNameLength + ADDRESS_LENGTH + CHAIN_ID_SIZE +
KEY_ID_SIZE + ALGORITHM_ID_SIZE;
size_t payloadSize = HEADER_SIZE + collectionNameLength + ADDRESS_LENGTH + CHAIN_ID_SIZE +
KEY_ID_SIZE + ALGORITHM_ID_SIZE;
if (dataLength < payloadSize) {
PRINTF("Data too small for payload: expected at least %d, got %d\n",
payloadSize,