Skip to content

Commit

Permalink
Add bounds check for read command
Browse files Browse the repository at this point in the history
  • Loading branch information
Baldanos committed Feb 23, 2024
1 parent 09ac850 commit 34e3d63
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/hydrabus/hydrabus_mode.c
Expand Up @@ -445,6 +445,11 @@ static int hydrabus_mode_read(t_hydra_console *con, t_tokenline_parsed *p,
count = 1;
}

if(count > UINT8_MAX) {
cprintf(con, "ERROR: read is limited to %d\r\n", UINT8_MAX);
return t - token_pos;
}

mode_status = !HYDRABUS_MODE_STATUS_OK;
if(con->mode->exec->read != NULL) {
mode_status = con->mode->exec->read(con, p_proto->buffer_rx, count);
Expand Down

0 comments on commit 34e3d63

Please sign in to comment.