瀏覽代碼

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

Jan-Philipp Litza 8 年之前
父節點
當前提交
bc3c8b3cc6
共有 1 個文件被更改,包括 2 次插入0 次删除
  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;