Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix some bugs regarding fuzzing #29

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/handle_provide_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ static void handle_lock_ids_array(ethPluginProvideParameter_t *msg, context_t *c
context->next_param = ID;
break;
case ID:
if (counter >= context->lisk.body.reward.lock_ids_len) {
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
copy_parameter(context->lisk.body.reward.lock_id[counter].value,
msg->parameter,
INT256_LENGTH);
Expand Down Expand Up @@ -154,12 +158,20 @@ static void handle_increase_locking_amount(ethPluginProvideParameter_t *msg, con
context->next_param = ID;
break;
case ID:
if (counter >= context->lisk.body.rewardIncLockingAmount.len) {
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
copy_parameter(context->lisk.body.rewardIncLockingAmount.first[counter].value,
msg->parameter,
INT256_LENGTH);
context->next_param = AMOUNT;
break;
case AMOUNT:
if (counter >= context->lisk.body.rewardIncLockingAmount.len) {
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
copy_parameter(context->lisk.body.rewardIncLockingAmount.second[counter].value,
msg->parameter,
INT256_LENGTH);
Expand Down Expand Up @@ -196,12 +208,20 @@ static void handle_extend_duration(ethPluginProvideParameter_t *msg, context_t *
context->next_param = ID;
break;
case ID:
if (counter >= context->lisk.body.rewardExtendDuration.len) {
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
copy_parameter(context->lisk.body.rewardExtendDuration.first[counter].value,
msg->parameter,
INT256_LENGTH);
context->next_param = DURATION;
break;
case DURATION:
if (counter >= context->lisk.body.rewardExtendDuration.len) {
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
copy_parameter(context->lisk.body.rewardExtendDuration.second[counter].value,
msg->parameter,
INT256_LENGTH);
Expand Down Expand Up @@ -384,6 +404,10 @@ static void handle_governor_propose(ethPluginProvideParameter_t *msg, context_t
context->next_param = TARGET_ADDRESS;
break;
case TARGET_ADDRESS:
if (counter >= context->lisk.body.governorPropose.data.len) {
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
copy_address(context->lisk.body.governorPropose.data.first[counter].value,
msg->parameter,
sizeof(context->lisk.body.governorPropose.data.first[counter].value));
Expand All @@ -395,6 +419,10 @@ static void handle_governor_propose(ethPluginProvideParameter_t *msg, context_t
}
break;
case SECOND_TARGET_ADDRESS:
if (counter >= context->lisk.body.governorPropose.data.len) {
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
copy_address(context->lisk.body.governorPropose.data.first[counter].value,
msg->parameter,
sizeof(context->lisk.body.governorPropose.data.first[counter].value));
Expand All @@ -413,6 +441,10 @@ static void handle_governor_propose(ethPluginProvideParameter_t *msg, context_t
context->next_param = VALUE;
break;
case VALUE:
if (counter >= context->lisk.body.governorPropose.value_len) {
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
copy_parameter(context->lisk.body.governorPropose.data.second[counter].value,
msg->parameter,
INT256_LENGTH);
Expand All @@ -424,6 +456,10 @@ static void handle_governor_propose(ethPluginProvideParameter_t *msg, context_t
}
break;
case SECOND_VALUE:
if (counter >= context->lisk.body.governorPropose.value_len) {
msg->result = ETH_PLUGIN_RESULT_ERROR;
break;
}
copy_parameter(context->lisk.body.governorPropose.data.second[counter].value,
msg->parameter,
INT256_LENGTH);
Expand Down
Loading