Add upper bound for withdrawal index
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "shared_context.h"
|
||||
#include "ethUtils.h"
|
||||
#include "utils.h"
|
||||
#include "withdrawal_index.h"
|
||||
|
||||
void getEth2PublicKey(uint32_t *bip32Path, uint8_t bip32PathLength, uint8_t *out);
|
||||
|
||||
@@ -98,6 +99,11 @@ void eth2_plugin_call(int message, void *parameters) {
|
||||
uint32_t withdrawalKeyPath[4];
|
||||
withdrawalKeyPath[0] = WITHDRAWAL_KEY_PATH_1;
|
||||
withdrawalKeyPath[1] = WITHDRAWAL_KEY_PATH_2;
|
||||
if (eth2WithdrawalIndex > INDEX_MAX) {
|
||||
PRINTF("eth2 plugin eth2 withdrawal index is too big\n");
|
||||
PRINTF("Got %u which is higher than INDEX_MAX (%u)\n", eth2WithdrawalIndex, INDEX_MAX);
|
||||
context->valid = 0;
|
||||
}
|
||||
withdrawalKeyPath[2] = eth2WithdrawalIndex;
|
||||
withdrawalKeyPath[3] = WITHDRAWAL_KEY_PATH_4;
|
||||
getEth2PublicKey(withdrawalKeyPath, 4, tmp);
|
||||
|
||||
Reference in New Issue
Block a user