Fix a segfault in state-script handling
authorSteven Barth <steven@midlink.org>
Fri, 17 Jan 2014 13:04:36 +0000 (14:04 +0100)
committerSteven Barth <steven@midlink.org>
Fri, 17 Jan 2014 13:04:36 +0000 (14:04 +0100)
src/dhcpv6-ia.c

index 2e93bd036081f3c983c95c4d247976c1f83287b3..88840a43e430f37ea376c3967381646dadf76305 100644 (file)
@@ -211,7 +211,7 @@ void dhcpv6_write_statefile(void)
                        if (iface->dhcpv6 != RELAYD_SERVER && iface->dhcpv4 != RELAYD_SERVER)
                                continue;
 
-                       if (iface->dhcpv6 == RELAYD_SERVER) {
+                       if (iface->dhcpv6 == RELAYD_SERVER && iface->ia_assignments.next) {
                                struct dhcpv6_assignment *c;
                                list_for_each_entry(c, &iface->ia_assignments, head) {
                                        if (c->clid_len == 0)
@@ -262,7 +262,7 @@ void dhcpv6_write_statefile(void)
                                }
                        }
 
-                       if (iface->dhcpv4 == RELAYD_SERVER) {
+                       if (iface->dhcpv4 == RELAYD_SERVER && iface->dhcpv4_assignments.next) {
                                struct dhcpv4_assignment *c;
                                list_for_each_entry(c, &iface->dhcpv4_assignments, head) {
                                        char ipbuf[INET6_ADDRSTRLEN];