Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-11-09 02:25:55 +0300
committerChristopher Faylor <me@cgf.cx>2005-11-09 02:25:55 +0300
commit8eb445cfd3df7dcb6b83304bc1f918985965e1af (patch)
tree388cefddad08297a7113522de4334d68b5f6aa45 /winsup
parentb397593c94941f7ef41a265e065f57dffaa7e9bd (diff)
* fhandler_base.cc (fhandler_base::readv): Free buf, not a pointer into the
middle of buf.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler.cc7
2 files changed, 9 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 30ca4015c..d51714b8d 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2005-11-08 Christopher Faylor <cgf@timesys.com>
+ * fhandler_base.cc (fhandler_base::readv): Free buf, not a pointer into
+ the middle of buf.
+
+2005-11-08 Christopher Faylor <cgf@timesys.com>
+
* memmem.cc: New file.
* include/cygwin/version.h: Bump API version number to 142.
* cygwin.din: Export memmem.
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index a8a27862a..6931cb6bc 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -969,7 +969,7 @@ fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
if (!len)
return 0;
- char *buf = (char *) malloc (tot);
+ char *buf = (char *) malloc (len);
if (!buf)
{
@@ -982,11 +982,12 @@ fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
const struct iovec *iovptr = iov;
+ char *p = buf;
while (nbytes > 0)
{
const int frag = min (nbytes, (ssize_t) iovptr->iov_len);
- memcpy (iovptr->iov_base, buf, frag);
- buf += frag;
+ memcpy (iovptr->iov_base, p, frag);
+ p += frag;
iovptr += 1;
nbytes -= frag;
}