From: Roy Marples Date: Tue, 6 Sep 2016 16:39:03 +0000 (+0000) Subject: Always roundup the required buffer. X-Git-Tag: v6.11.4~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4faac32f3a6b1120bed7272bdea473da886a64d0;p=thirdparty%2Fdhcpcd.git Always roundup the required buffer. --- diff --git a/common.c b/common.c index c2bb94e9..cbea738e 100644 --- a/common.c +++ b/common.c @@ -411,9 +411,10 @@ recvmsg_realloc(int fd, struct msghdr *msg, int flags) * on truncation, not the actual size needed. * So grow the buffer and try again. */ if (iov->iov_len == len) - len = roundup(len + 1, IOVEC_BUFSIZ); + len++; else if (iov->iov_len > len) break; + len = roundup(len, IOVEC_BUFSIZ); if ((n = realloc(iov->iov_base, len)) == NULL) return -1; iov->iov_base = n;