From 8cc7121600eab0e28495e48f559d4886ba879c95 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Tue, 15 Oct 2013 12:19:48 +0200 Subject: [PATCH] Fix more memory corruption --- src/config.c | 4 ++-- src/router.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/config.c b/src/config.c index e455965..4aaded9 100644 --- a/src/config.c +++ b/src/config.c @@ -532,7 +532,7 @@ void odhcpd_run(void) #endif // Evaluate hybrid mode for master - struct interface *master = NULL, *i; + struct interface *master = NULL, *i, *n; list_for_each_entry(i, &interfaces, head) { if (!i->master) continue; @@ -557,7 +557,7 @@ void odhcpd_run(void) } - list_for_each_entry(i, &interfaces, head) { + list_for_each_entry_safe(i, n, &interfaces, head) { if (i->inuse && !i->ignore) { // Resolve hybrid mode if (i->dhcpv6 == RELAYD_HYBRID) diff --git a/src/router.c b/src/router.c index bb7ddcd..9258acf 100644 --- a/src/router.c +++ b/src/router.c @@ -352,7 +352,7 @@ static void send_router_advert(struct uloop_timeout *event) uint8_t pad2; uint32_t lifetime; uint8_t name[]; - } *search = malloc(sizeof(*search) + search_padded); + } *search = alloca(sizeof(*search) + search_padded); search->type = ND_OPT_DNS_SEARCH; search->len = search_len ? ((sizeof(*search) + search_padded) / 8) : 0; search->pad = 0; @@ -409,7 +409,6 @@ static void send_router_advert(struct uloop_timeout *event) struct sockaddr_in6 all_nodes = {AF_INET6, 0, 0, ALL_IPV6_NODES, 0}; odhcpd_send(router_event.uloop.fd, &all_nodes, iov, ARRAY_SIZE(iov), iface); - free(search); // Rearm timer int msecs; -- 2.25.1