From: Roy Marples Date: Wed, 18 Mar 2015 12:07:02 +0000 (+0000) Subject: Fix creation of normal IPv6 link-local addresses overflowing the X-Git-Tag: v6.8.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfbb98169a2c89668707fea913e7999c285def03;p=thirdparty%2Fdhcpcd.git Fix creation of normal IPv6 link-local addresses overflowing the address and fooling dhcpcd into thinking it's not tentative when added. --- diff --git a/ipv6.c b/ipv6.c index 54053cf4..2187c461 100644 --- a/ipv6.c +++ b/ipv6.c @@ -1149,7 +1149,7 @@ nextslaacprivate: } ap->dadcounter = dadcounter; } else { - memcpy(ap->addr.s6_addr, ap->prefix.s6_addr, ap->prefix_len); + memcpy(ap->addr.s6_addr, ap->prefix.s6_addr, 8); switch (ifp->family) { case ARPHRD_ETHER: if (ifp->hwlen == 6) { @@ -1163,6 +1163,11 @@ nextslaacprivate: ap->addr.s6_addr[15] = ifp->hwaddr[5]; } else if (ifp->hwlen == 8) memcpy(&ap->addr.s6_addr[8], ifp->hwaddr, 8); + else { + free(ap); + errno = ENOTSUP; + return -1; + } break; }