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>
This commit is contained in:
Corinna Vinschen 2017-01-19 21:08:53 +01:00
parent abfcf32732
commit e2ab9b71fa
1 changed files with 3 additions and 3 deletions

View File

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