diff options
author | Christopher Faylor <me@cgf.cx> | 2001-10-19 06:27:19 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-10-19 06:27:19 +0400 |
commit | da8f3291d1d4f5bd77e057cd75ae1c7e2de0ffb5 (patch) | |
tree | 7ab6c7f73dbc12bad3b0775d1f0b68b1040f07fb /winsup | |
parent | 5e709b88c52c58c1cbbe62dfd015f4066c433e89 (diff) |
* syscalls.cc (_read): Validate input pointer.
(_write): Ditto.
(system): Ditto.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 15f55fa2c..5a8ed18f4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2001-10-18 Christopher Faylor <cgf@redhat.com> + + * syscalls.cc (_read): Validate input pointer. + (_write): Ditto. + (system): Ditto. + 2001-10-16 Frederic Devernay <Frederic.Devernay@sophia.inria.fr> * poll.cc (poll): Call cygwin_select() if any fd is valid. diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 3224de358..70d66dd59 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -287,6 +287,9 @@ setsid (void) extern "C" ssize_t _read (int fd, void *ptr, size_t len) { + if (__check_null_invalid_struct_errno (ptr, len)) + return -1; + int res; extern int sigcatchers; int e = get_errno (); @@ -341,9 +344,12 @@ _read (int fd, void *ptr, size_t len) extern "C" ssize_t _write (int fd, const void *ptr, size_t len) { + if (__check_null_invalid_struct_errno (ptr, len)) + return -1; + int res = -1; - sigframe thisframe (mainthread); + sigframe thisframe (mainthread); cygheap_fdget cfd (fd); if (cfd < 0) goto done; @@ -1245,6 +1251,9 @@ done: extern "C" int system (const char *cmdstring) { + if (check_null_empty_str_errno (cmdstring)) + return -1; + sigframe thisframe (mainthread); int res; const char* command[4]; |