From 21f18761aae87ed8bfe5258511eeb170c3081716 Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Thu, 28 Nov 2024 23:31:09 -0600 Subject: [PATCH] fix: iomanX perform lower bounds check on fd before returning --- iop/system/iomanx/src/iomanX.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iop/system/iomanx/src/iomanX.c b/iop/system/iomanx/src/iomanX.c index 92830f08d9d..4bd2ad3fbae 100644 --- a/iop/system/iomanx/src/iomanX.c +++ b/iop/system/iomanx/src/iomanX.c @@ -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]; }