diff options
author | Christopher Faylor <me@cgf.cx> | 2012-12-31 18:31:49 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2012-12-31 18:31:49 +0000 |
commit | f6187d46b117f281040e2b9a9f3bdabe60954156 (patch) | |
tree | fbc8df0e5be98ae0c76f22b4f7a71e4bd017a197 /winsup | |
parent | 871d0724fa3251afb026608af733d6eea4dce8fd (diff) | |
download | newlib-f6187d46b117f281040e2b9a9f3bdabe60954156.zip newlib-f6187d46b117f281040e2b9a9f3bdabe60954156.tar.gz newlib-f6187d46b117f281040e2b9a9f3bdabe60954156.tar.bz2 |
* dtable.cc (dtable::dup3): Fix bounds checking for valid newfd.
* syscalls.cc (dup2): Ditto.
* winsup.h (events_terminate): Delete obsolete function declaration.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/dtable.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/winsup.h | 1 |
4 files changed, 8 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 96471a0..89eb529 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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. diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 2a9f8b0..0b6cee3 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -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); diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 43ecf3a..fe89f84 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -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; diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 0638b44..21082c6 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -185,7 +185,6 @@ void uinfo_init (); /* various events */ void events_init (); -void events_terminate (); void __stdcall close_all_files (bool = false); |