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] Don't assert on sum of iov_len overflowing an ssize_t


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

commit e2ab9b71fa49b5295fe7387e18e37b6d81d7ddc2
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Thu Jan 19 21:08:53 2017 +0100

    Don't assert on sum of iov_len overflowing an ssize_t
    
    Rather return EINVAL per POSIX.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/miscfuncs.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 1276695..e042d00 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -10,7 +10,6 @@ details. */
 #include "miscfuncs.h"
 #include <ntsecapi.h>
 #include <sys/uio.h>
-#include <assert.h>
 #include <alloca.h>
 #include <limits.h>
 #include <sys/param.h>
@@ -81,9 +80,10 @@ check_iovec (const struct iovec *iov, int iovcnt, bool forwrite)
 	  iovcnt--;
 	}
 
-      assert (tot <= SSIZE_MAX);
+      if (tot <= SSIZE_MAX)
+	return (ssize_t) tot;
 
-      return (ssize_t) tot;
+      set_errno (EINVAL);
     }
   __except (EFAULT)
   __endtry


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