summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2022-03-17 21:53:25 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2022-03-17 21:53:45 +0100
commit4cf97abfee61209774151e051c93042d8bfab5ee (patch)
treecb1d235ca8d8754f3e0c7463e8878ea768da487f /src/rule.c
parent4e718641397c876315a87db441afc53139863122 (diff)
rule: Avoid segfault with anonymous chains
Phil Sutter says: "When trying to add a rule which contains an anonymous chain to a non-existent chain, string_misspell_update() is called with a NULL string because the anonymous chain has no name. Avoid this by making the function NULL-pointer tolerant." Fixes: c330152b7f777 ("src: support for implicit chain bindings") Reported-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rule.c b/src/rule.c
index b1700c40..19b8cb03 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -758,6 +758,9 @@ struct chain *chain_lookup_fuzzy(const struct handle *h,
struct table *table;
struct chain *chain;
+ if (!h->chain.name)
+ return NULL;
+
string_misspell_init(&st);
list_for_each_entry(table, &cache->table_cache.list, cache.list) {