diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2005-12-08 10:55:29 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2005-12-08 10:55:29 +0000 |
commit | 7d6fde96deca12d77c7bd00c5d3216b94eb1bdea (patch) | |
tree | eb555cf4c9b21733c2254220f3f5cb437e87846f | |
parent | ddd62ccbd4e10b481ee67b54548765f045fddc80 (diff) | |
download | newlib-7d6fde96deca12d77c7bd00c5d3216b94eb1bdea.zip newlib-7d6fde96deca12d77c7bd00c5d3216b94eb1bdea.tar.gz newlib-7d6fde96deca12d77c7bd00c5d3216b94eb1bdea.tar.bz2 |
* fhandler_raw.cc (fhandler_dev_raw::ioctl): Only allow 0, 1 or a
multiple of 512 as new buffersize.
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_raw.cc | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index dcea0ef..f423704 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2005-12-08 Corinna Vinschen <corinna@vinschen.de> + + * fhandler_raw.cc (fhandler_dev_raw::ioctl): Only allow 0, 1 or a + multiple of 512 as new buffersize. + 2005-12-08 Pekka Pessi <ppessi@gmail.com> Corinna Vinschen <corinna@vinschen.de> diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index e4d4e36..00d023e 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -157,8 +157,14 @@ fhandler_dev_raw::ioctl (unsigned int cmd, void *buf) mop.mt_count = op->rd_parm; ret = ioctl (MTIOCTOP, &mop); } - else if (devbuf && ((op->rd_parm <= 1 && (devbufend - devbufstart)) - || op->rd_parm < devbufend - devbufstart)) + else if ((devbuf && ((op->rd_parm <= 1 && (devbufend - devbufstart)) + || op->rd_parm < devbufend - devbufstart)) + || (op->rd_parm > 1 && (op->rd_parm % 512))) + /* The conditions for a *valid* parameter are these: + - If there's still data in the current buffer, it must + fit in the new buffer. + - The new size is either 0 or 1, both indicating unbufferd + I/O, or the new buffersize must be a multiple of 512. */ ret = ERROR_INVALID_PARAMETER; else if (!devbuf || op->rd_parm != devbufsiz) { |