Browse Source

gluon-radv-filterd: Fix use-after-free when best router expires

Jan-Philipp Litza 7 years ago
parent
commit
bc3c8b3cc6
1 changed files with 2 additions and 0 deletions
  1. 2 0
      package/gluon-radv-filterd/src/gluon-radv-filterd.c

+ 2 - 0
package/gluon-radv-filterd/src/gluon-radv-filterd.c

@@ -312,6 +312,8 @@ static void expire_routers() {
 		if (router->eol < now) {
 			DEBUG_MSG("router " F_MAC " expired", F_MAC_VAR(router->src));
 			*prev_ptr = router->next;
+			if (G.best_router == router)
+				G.best_router = NULL;
 			free(router);
 		} else {
 			prev_ptr = &router->next;