]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: filters: check the filter name before comparing it
authorDragan Dosen <ddosen@haproxy.com>
Mon, 31 Aug 2026 22:43:56 +0000 (22:43 +0000)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 1 Sep 2026 11:47:07 +0000 (13:47 +0200)
compile_filter_sequence_elt() looks a filter up by name with strcmp(),
without checking whether the filter configuration has a name. Only the
filters declared with the "filter" keyword get one, assigned by
parse_filter(). The filters which the configuration inserts on its own
never go through that function and leave the name NULL, so haproxy can
crash while parsing a configuration which combines a "filter-sequence"
line with any of those, for example:

    frontend f
        bind :8080
        compression algo gzip
        filter-sequence request non-existent

Let's skip the filters which have no name. They cannot be referenced in
a "filter-sequence" line anyway, so the lookup now fails and reports
"invalid filter name".

This should be backported to all branches which have "filter-sequence".

src/filters.c

index f118fd0cd803fa837f2a0ffb7dfc435afb3d8904..a972c7218ce240b66fafa06b1aee5c0226bf22cb 100644 (file)
@@ -380,7 +380,7 @@ static int compile_filter_sequence_elt(struct proxy *px, struct filter_sequence_
        int ret = ERR_NONE;
 
        list_for_each_entry(fconf, &px->filter_configs, list) {
-               if (strcmp(elt->flt_name, fconf->name) == 0) {
+               if (fconf->name && strcmp(elt->flt_name, fconf->name) == 0) {
                        elt->flt_conf = fconf;
                        break;
                }