Avoid an infinite loop if the last element of the iov array passed to

writev() has an iov_len of 0.

PR:		bin/8281
This commit is contained in:
jasone 1999-12-16 22:35:40 +00:00
parent f9019037ba
commit 395027ca77
3 changed files with 39 additions and 3 deletions

View File

@ -136,8 +136,20 @@ writev(int fd, const struct iovec * iov, int iovcnt)
cnt = 0;
}
}
}
} else if (n == 0) {
/*
* Avoid an infinite loop if the last iov_len is
* 0.
*/
while (idx < iovcnt && p_iov[idx].iov_len == 0)
idx++;
if (idx == iovcnt) {
ret = num;
break;
}
}
/*
* If performing a blocking write, check if the
* write would have blocked or if some bytes

View File

@ -136,8 +136,20 @@ writev(int fd, const struct iovec * iov, int iovcnt)
cnt = 0;
}
}
}
} else if (n == 0) {
/*
* Avoid an infinite loop if the last iov_len is
* 0.
*/
while (idx < iovcnt && p_iov[idx].iov_len == 0)
idx++;
if (idx == iovcnt) {
ret = num;
break;
}
}
/*
* If performing a blocking write, check if the
* write would have blocked or if some bytes

View File

@ -136,8 +136,20 @@ writev(int fd, const struct iovec * iov, int iovcnt)
cnt = 0;
}
}
}
} else if (n == 0) {
/*
* Avoid an infinite loop if the last iov_len is
* 0.
*/
while (idx < iovcnt && p_iov[idx].iov_len == 0)
idx++;
if (idx == iovcnt) {
ret = num;
break;
}
}
/*
* If performing a blocking write, check if the
* write would have blocked or if some bytes