Fix segfault
authorSteven Barth <steven@midlink.org>
Fri, 1 Feb 2013 08:25:32 +0000 (09:25 +0100)
committerSteven Barth <steven@midlink.org>
Fri, 1 Feb 2013 08:25:32 +0000 (09:25 +0100)
src/ra.c

index 2149a66b7ce929b81fc7bf44e4ab373d9ccead7d..47a2a8d3e5d760ef9652b12ed2d6ca71b5db3229 100644 (file)
--- a/src/ra.c
+++ b/src/ra.c
@@ -275,7 +275,7 @@ bool ra_process(void)
 
                size_t ra_dns_len;
                struct odhcp6c_entry *entry = odhcp6c_get_state(STATE_RA_DNS, &ra_dns_len);
-               for (size_t i = 0; i < len / sizeof(*entry); ++i)
+               for (size_t i = 0; i < ra_dns_len / sizeof(*entry); ++i)
                        if (IN6_ARE_ADDR_EQUAL(&entry[i].router, &from.sin6_addr) &&
                                        entry[i].valid > router_valid)
                                entry[i].valid = router_valid;