Skip to content

Commit

Permalink
fix: iomanX perform lower bounds check on fd before returning
Browse files Browse the repository at this point in the history
  • Loading branch information
uyjulian committed Nov 29, 2024
1 parent 0fa8842 commit 21f1876
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion iop/system/iomanx/src/iomanX.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ static iomanX_iop_file_t *new_iob(void)

static iomanX_iop_file_t *get_iob(int fd)
{
if ( ((unsigned int)fd >= (sizeof(file_table) / sizeof(file_table[0]))) || (!file_table[fd].device) )
if ( (fd < 0) || ((unsigned int)fd >= (sizeof(file_table) / sizeof(file_table[0]))) || (!file_table[fd].device) )
return NULL;
return &file_table[fd];
}
Expand Down

0 comments on commit 21f1876

Please sign in to comment.