This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] check_iovec: Change test to be more robust against invalid iovcnt values


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=946cd7df284175e5c36140349a4173ac64a76115

commit 946cd7df284175e5c36140349a4173ac64a76115
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Thu Jan 19 21:11:22 2017 +0100

    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>

Diff:
---
 winsup/cygwin/miscfuncs.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)
 	    {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]