mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Prevent dup2(2) from closing internal libc_r pipe descriptors.
PR: misc/28947 Reviewed by: jasone, ru Approved by: jasone, ru MFC after: 1 week
This commit is contained in:
parent
0878d2e5e9
commit
b85282ba08
1 changed files with 2 additions and 1 deletions
|
|
@ -45,7 +45,8 @@ _dup2(int fd, int newfd)
|
|||
int newfd_opened;
|
||||
|
||||
/* Check if the file descriptor is out of range: */
|
||||
if (newfd < 0 || newfd >= _thread_dtablesize) {
|
||||
if (newfd < 0 || newfd >= _thread_dtablesize ||
|
||||
newfd == _thread_kern_pipe[0] || newfd == _thread_kern_pipe[1]) {
|
||||
/* Return a bad file descriptor error: */
|
||||
errno = EBADF;
|
||||
ret = -1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue