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>
This commit is contained in:
Corinna Vinschen 2017-01-19 21:11:22 +01:00
parent e2ab9b71fa
commit 946cd7df28
1 changed files with 1 additions and 1 deletions

View File

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