From: Karel Zak Date: Mon, 29 Apr 2024 12:55:16 +0000 (+0200) Subject: wall: make sure unsigned variable not underflow X-Git-Tag: v2.42-start~368 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1658c0150e4a3d87d1e36b7755de0079e2e6a133;p=thirdparty%2Futil-linux.git wall: make sure unsigned variable not underflow Signed-off-by: Karel Zak --- diff --git a/term-utils/ttymsg.c b/term-utils/ttymsg.c index faa0344fe..ef7e35899 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;