mirror of
https://github.com/opnsense/src.git
synced 2026-06-14 19:20:18 -04:00
Sanity check fd before using it as an array index.
Noticed by: ted@NLnetLabs.nl (Ted Lindgreen) Approved by: ru
This commit is contained in:
parent
dff6f51034
commit
f970961773
1 changed files with 2 additions and 1 deletions
|
|
@ -49,7 +49,8 @@ _close(int fd)
|
|||
struct stat sb;
|
||||
struct fd_table_entry *entry;
|
||||
|
||||
if ((fd == _thread_kern_pipe[0]) || (fd == _thread_kern_pipe[1]) ||
|
||||
if ((fd < 0) || (fd >= _thread_dtablesize) ||
|
||||
(fd == _thread_kern_pipe[0]) || (fd == _thread_kern_pipe[1]) ||
|
||||
(_thread_fd_table[fd] == NULL)) {
|
||||
/*
|
||||
* Don't allow silly programs to close the kernel pipe
|
||||
|
|
|
|||
Loading…
Reference in a new issue