]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure we read the full lease.
authorRoy Marples <roy@marples.name>
Wed, 12 Jun 2013 15:21:05 +0000 (15:21 +0000)
committerRoy Marples <roy@marples.name>
Wed, 12 Jun 2013 15:21:05 +0000 (15:21 +0000)
dhcp6.c

diff --git a/dhcp6.c b/dhcp6.c
index aa93e4d6b2dc1d2e134844b166e0113489dc85de..08a51a873b438cf9a20cb5b8b03e58938077045d 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -1572,6 +1572,10 @@ dhcp6_readlease(struct interface *ifp)
                return -1;
        bytes = read(fd, state->new, state->new_len);
        close(fd);
+       if (bytes < (ssize_t)state->new_len) {
+               syslog(LOG_ERR, "%s: read: %m", __func__);
+               goto ex;
+       }
 
        /* Check to see if the lease is still valid */
        fd = dhcp6_validatelease(ifp, state->new, state->new_len, NULL);