Browse Source

Revert "lib: Fix Free Pointer dereference in lib/filter.c"

This reverts commit 4fdb5f401eb277fa54d80e99d241bd9b03895a6a.

This introduces bugs, as callers are using the same hook for add/delete.
Using a pattern of looking up the access-list by name, and updating their
internal references by its result.  With the access-list still active when
the delete hook is called, this swaps a use-after-free or NULL deref in one
hook for use-after-frees in many other places.

See https://bugzilla.quagga.net/show_bug.cgi?id=945
Paul Jakma 2 years ago
parent
commit
6af87e10d6
1 changed files with 4 additions and 4 deletions
  1. 4 4
      lib/filter.c

+ 4 - 4
lib/filter.c

@@ -493,13 +493,13 @@ access_list_filter_delete (struct access_list *access, struct filter *filter)
 
   filter_free (filter);
 
-  /* Run hook function. */
-  if (master->delete_hook)
-    (*master->delete_hook) (access);
-
   /* If access_list becomes empty delete it from access_master. */
   if (access_list_empty (access))
     access_list_delete (access);
+
+  /* Run hook function. */
+  if (master->delete_hook)
+    (*master->delete_hook) (access);
 }
 
 /*