summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2025-06-15 11:33:42 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2025-08-13 20:44:27 +0200
commit018e5bd610ef9d287de2a36143cce659250341d7 (patch)
treeb95f2cfa47eb28926d5cd0025e1083e049f379fc
parent10da83c6d02318160ac561dd08fbf153d19cc407 (diff)
rule: skip fuzzy lookup if object name is not available
commit de8396358f869d6d7640eae6d6287c2f7fb0d3dc upstream. Skip fuzzy lookup for suggestions when handles are used. Note that 4cf97abfee61 ("rule: Avoid segfault with anonymous chains") already skips it for chain. Fixes: 285bb67a11ad ("src: introduce simple hints on incorrect set") Fixes: 9f7817a4e022 ("src: introduce simple hints on incorrect chain") Fixes: d7476ddd5f7d ("src: introduce simple hints on incorrect table") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/rule.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rule.c b/src/rule.c
index 3806465f..bdaf8c9f 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -210,6 +210,9 @@ struct set *set_lookup_fuzzy(const char *set_name,
struct table *table;
struct set *set;
+ if (!set_name)
+ return NULL;
+
string_misspell_init(&st);
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
@@ -1189,6 +1192,9 @@ struct table *table_lookup_fuzzy(const struct handle *h,
struct string_misspell_state st;
struct table *table;
+ if (!h->table.name)
+ return NULL;
+
string_misspell_init(&st);
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
@@ -1850,6 +1856,9 @@ struct obj *obj_lookup_fuzzy(const char *obj_name,
struct table *table;
struct obj *obj;
+ if (!obj_name)
+ return NULL;
+
string_misspell_init(&st);
list_for_each_entry(table, &cache->table_cache.list, cache.list) {
@@ -2344,6 +2353,9 @@ struct flowtable *flowtable_lookup_fuzzy(const char *ft_name,
struct table *table;
struct flowtable *ft;
+ if (!ft_name)
+ return NULL;
+
string_misspell_init(&st);
list_for_each_entry(table, &cache->table_cache.list, cache.list) {