Add max and min values and restrict bounds

This commit is contained in:
pscott
2021-04-15 16:19:12 +02:00
parent 9876999b8d
commit 99950a396c
2 changed files with 4 additions and 1 deletions

View File

@@ -264,7 +264,7 @@ static parserStatus_e processTxInternal(txContext_t *context) {
return USTREAM_PROCESSING; return USTREAM_PROCESSING;
} }
// EIP 2718: TransactionType might be present before the TransactionPayload. // EIP 2718: TransactionType might be present before the TransactionPayload.
if (*context->workBuffer > 0x00 && *context->workBuffer < 0x7f) { if (*context->workBuffer >= MIN_TX_TYPE && *context->workBuffer <= MAX_TX_TYPE) {
uint8_t maybeType = *context->workBuffer; uint8_t maybeType = *context->workBuffer;
PRINTF("TX TYPE: %u\n", maybeType); PRINTF("TX TYPE: %u\n", maybeType);

View File

@@ -53,6 +53,9 @@ typedef enum rlpTxField_e {
TX_RLP_DONE TX_RLP_DONE
} rlpTxField_e; } rlpTxField_e;
#define MIN_TX_TYPE 0x00
#define MAX_TX_TYPE 0x7f
// EIP 2718 TransactionType // EIP 2718 TransactionType
typedef enum txType_e { typedef enum txType_e {
LEGACY_TX, LEGACY_TX,