]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stick-table: Always call smp_fetch_src() with a valid arg list
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 29 Jan 2021 09:27:47 +0000 (10:27 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 29 Jan 2021 12:24:16 +0000 (13:24 +0100)
The sample fetch functions must always be called with a valid argument
list. When called by hand, if there is no argument to pass, empty_arg_list must
be used.

In the stick-table code, there are some calls to smp_fetch_src() with NULL as
argument list. It is changed to use empty_arg_list instead. It is not really a
bug because smp_fetch_src() does not use the argument list. But it is an API
bug.

This patch may be backported to all stable branches as a cleanup.

src/stick_table.c

index 485f6f18411a69188b29a737d99211572c77e45a..548d97c4d3a0d6630cf751c52176f2a042c1f472 100644 (file)
@@ -2247,7 +2247,7 @@ smp_fetch_sc_stkctr(struct session *sess, struct stream *strm, const struct arg
                smp.px = NULL;
                smp.sess = sess;
                smp.strm = strm;
-               if (!smp_fetch_src || !smp_fetch_src(NULL, &smp, NULL, NULL))
+               if (!smp_fetch_src || !smp_fetch_src(empty_arg_list, &smp, NULL, NULL))
                        return NULL;
 
                /* Converts into key. */
@@ -2312,7 +2312,7 @@ smp_create_src_stkctr(struct session *sess, struct stream *strm, const struct ar
        smp.px = NULL;
        smp.sess = sess;
        smp.strm = strm;
-       if (!smp_fetch_src || !smp_fetch_src(NULL, &smp, NULL, NULL))
+       if (!smp_fetch_src || !smp_fetch_src(empty_arg_list, &smp, NULL, NULL))
                return NULL;
 
        /* Converts into key. */
@@ -2844,7 +2844,7 @@ smp_fetch_src_updt_conn_cnt(const struct arg *args, struct sample *smp, const ch
                return 0;
 
        /* Fetch source address in a sample. */
-       if (!smp_fetch_src || !smp_fetch_src(NULL, smp, NULL, NULL))
+       if (!smp_fetch_src || !smp_fetch_src(empty_arg_list, smp, NULL, NULL))
                return 0;
 
        /* Converts into key. */