summaryrefslogtreecommitdiff
path: root/boot/efi/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'boot/efi/file.c')
-rw-r--r--boot/efi/file.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/boot/efi/file.c b/boot/efi/file.c
index e45ce78..56c0345 100644
--- a/boot/efi/file.c
+++ b/boot/efi/file.c
@@ -31,7 +31,7 @@ static EFI_SIMPLE_TEXT_INPUT_PROTOCOL *fd_to_inconsole(int fd)
return fd == STDIN_FILENO ? efi_context->system_table->ConIn : nullptr;
}
-static EFI_FILE_PROTOCOL *open_files[FD_COUNT];
+static EFI_FILE_PROTOCOL *open_files[FD_COUNT] = { nullptr };
static EFI_FILE_PROTOCOL *fd_to_file(int fd)
{
@@ -58,7 +58,7 @@ static int alloc_fd(void)
static void free_fd(int fd)
{
- if (fd < FD_MIN || fd > FD_MAX)
+ if (fd >= FD_MIN && fd <= FD_MAX)
{
open_files[fd] = nullptr;
}
@@ -104,7 +104,7 @@ int efi_open(const char *path, int flags, int mode)
int fd = alloc_fd();
- if (fd < FD_MIN)
+ if (fd < FD_MIN || fd > FD_MAX)
{
return -1;
}