Skip to content

Commit e3bea49

Browse files
authored
Merge pull request #685 from uyjulian/iomanx_fd_lower_bounds_check
iomanX perform lower bounds check on fd before returning
2 parents 0fa8842 + 21f1876 commit e3bea49

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

iop/system/iomanx/src/iomanX.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ static iomanX_iop_file_t *new_iob(void)
979979

980980
static iomanX_iop_file_t *get_iob(int fd)
981981
{
982-
if ( ((unsigned int)fd >= (sizeof(file_table) / sizeof(file_table[0]))) || (!file_table[fd].device) )
982+
if ( (fd < 0) || ((unsigned int)fd >= (sizeof(file_table) / sizeof(file_table[0]))) || (!file_table[fd].device) )
983983
return NULL;
984984
return &file_table[fd];
985985
}

0 commit comments

Comments
 (0)