]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Always roundup the required buffer.
authorRoy Marples <roy@marples.name>
Tue, 6 Sep 2016 16:39:03 +0000 (16:39 +0000)
committerRoy Marples <roy@marples.name>
Tue, 6 Sep 2016 16:39:03 +0000 (16:39 +0000)
common.c

index c2bb94e9653729ae0a61427763742eae5df699d3..cbea738e81e7908b79e16016557680926af8410b 100644 (file)
--- 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;