* dtable.cc (dtable::dup3): Fix bounds checking for valid newfd.
* syscalls.cc (dup2): Ditto. * winsup.h (events_terminate): Delete obsolete function declaration.
This commit is contained in:
parent
871d0724fa
commit
f6187d46b1
|
@ -1,3 +1,9 @@
|
|||
2012-12-31 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||
|
||||
* dtable.cc (dtable::dup3): Fix bounds checking for valid newfd.
|
||||
* syscalls.cc (dup2): Ditto.
|
||||
* winsup.h (events_terminate): Delete obsolete function declaration.
|
||||
|
||||
2012-12-28 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||
|
||||
* DevNotes: Add entry cgf-000019.
|
||||
|
|
|
@ -728,7 +728,7 @@ dtable::dup3 (int oldfd, int newfd, int flags)
|
|||
set_errno (EBADF);
|
||||
goto done;
|
||||
}
|
||||
if (newfd < 0)
|
||||
if (newfd >= OPEN_MAX_MAX || newfd < 0)
|
||||
{
|
||||
syscall_printf ("new fd out of bounds: %d", newfd);
|
||||
set_errno (EBADF);
|
||||
|
|
|
@ -142,7 +142,7 @@ extern "C" int
|
|||
dup2 (int oldfd, int newfd)
|
||||
{
|
||||
int res;
|
||||
if (newfd >= OPEN_MAX_MAX)
|
||||
if (newfd >= OPEN_MAX_MAX || newfd < 0)
|
||||
{
|
||||
set_errno (EBADF);
|
||||
res = -1;
|
||||
|
|
|
@ -185,7 +185,6 @@ void uinfo_init ();
|
|||
|
||||
/* various events */
|
||||
void events_init ();
|
||||
void events_terminate ();
|
||||
|
||||
void __stdcall close_all_files (bool = false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue