aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/miscfuncs.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2017-01-19 21:11:22 +0100
committerCorinna Vinschen <corinna@vinschen.de>2017-01-19 21:11:22 +0100
commit946cd7df284175e5c36140349a4173ac64a76115 (patch)
treeb9e0a79e157b03b894e2ef5c3d14c6951be65fcb /winsup/cygwin/miscfuncs.cc
parente2ab9b71fa49b5295fe7387e18e37b6d81d7ddc2 (diff)
downloadnewlib-946cd7df284175e5c36140349a4173ac64a76115.zip
newlib-946cd7df284175e5c36140349a4173ac64a76115.tar.gz
newlib-946cd7df284175e5c36140349a4173ac64a76115.tar.bz2
check_iovec: Change test to be more robust against invalid iovcnt values
Stop running wild if iovcnt is < 0 to begin with. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/miscfuncs.cc')
-rw-r--r--winsup/cygwin/miscfuncs.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index e042d00..63e60f0 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -60,7 +60,7 @@ check_iovec (const struct iovec *iov, int iovcnt, bool forwrite)
size_t tot = 0;
- while (iovcnt != 0)
+ while (iovcnt > 0)
{
if (iov->iov_len > SSIZE_MAX || (tot += iov->iov_len) > SSIZE_MAX)
{