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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=116092
@ -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 New Issue
Block a user