summaryrefslogtreecommitdiffstats
path: root/term-utils/ttymsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'term-utils/ttymsg.c')
-rw-r--r--term-utils/ttymsg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/term-utils/ttymsg.c b/term-utils/ttymsg.c
index faa0344..ef7e358 100644
--- a/term-utils/ttymsg.c
+++ b/term-utils/ttymsg.c
@@ -123,7 +123,7 @@ ttymsg(struct iovec *iov, size_t iovcnt, char *line, int tmout) {
iovcnt * sizeof(struct iovec));
iov = localiov;
}
- for (cnt = 0; wret >= (ssize_t) iov->iov_len; ++cnt) {
+ for (cnt = 0; wret >= (ssize_t) iov->iov_len && iovcnt > 0; ++cnt) {
wret -= iov->iov_len;
++iov;
--iovcnt;