]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
sla could be NULL, so check that.
authorRoy Marples <roy@marples.name>
Mon, 24 Apr 2017 16:53:05 +0000 (17:53 +0100)
committerRoy Marples <roy@marples.name>
Mon, 24 Apr 2017 16:53:05 +0000 (17:53 +0100)
src/dhcp6.c

index e25880692f31ccd931d623eb020b3ead0fb2db06..dfa8d91dba7ff7a261a48ede9285b3e09e492483 100644 (file)
@@ -2416,7 +2416,7 @@ dhcp6_ifdelegateaddr(struct interface *ifp, struct ipv6_addr *prefix,
        if (strcmp(ifp->name, prefix->iface->name) == 0) {
                if (prefix->prefix_exclude_len == 0) {
                        /* Don't spam the log automatically */
-                       if (sla)
+                       if (sla != NULL)
                                logwarnx("%s: DHCPv6 server does not support "
                                    "OPTION_PD_EXCLUDE",
                                    ifp->name);
@@ -2428,14 +2428,14 @@ dhcp6_ifdelegateaddr(struct interface *ifp, struct ipv6_addr *prefix,
            sla, if_ia)) == -1)
                return NULL;
 
-       if (fls64(sla->suffix) > 128 - pfxlen) {
+       if (sla != NULL && fls64(sla->suffix) > 128 - pfxlen) {
                logerrx("%s: suffix %" PRIu64 " + prefix_len %d > 128",
                    ifp->name, sla->suffix, pfxlen);
                return NULL;
        }
 
        /* Add our suffix */
-       if (sla->suffix) {
+       if (sla != NULL && sla->suffix != 0) {
                daddr = addr;
                vl = be64dec(addr.s6_addr + 8);
                vl |= sla->suffix;