]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http: check the source address via conn_get_src() in sample fetch functions
authorWilly Tarreau <w@1wt.eu>
Wed, 17 Jul 2019 14:57:03 +0000 (16:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 19 Jul 2019 11:50:09 +0000 (13:50 +0200)
In smp_fetch_url32_src() and smp_fetch_base32_src() it's better to
validate that the source address was properly initialized since it
will soon be dynamic, thus let's call conn_get_src().

src/http_fetch.c

index 08e71f4b40d494387eae13f42868145a24c55673..a5c70008acaa969f99bfd3bf6e770f772a385f86 100644 (file)
@@ -1079,7 +1079,7 @@ static int smp_fetch_base32_src(const struct arg *args, struct sample *smp, cons
        struct buffer *temp;
        struct connection *cli_conn = objt_conn(smp->sess->origin);
 
-       if (!cli_conn)
+       if (!cli_conn || !conn_get_src(cli_conn))
                return 0;
 
        if (!smp_fetch_base32(args, smp, kw, private))
@@ -1784,7 +1784,7 @@ static int smp_fetch_url32_src(const struct arg *args, struct sample *smp, const
        struct buffer *temp;
        struct connection *cli_conn = objt_conn(smp->sess->origin);
 
-       if (!cli_conn)
+       if (!cli_conn || !conn_get_src(cli_conn))
                return 0;
 
        if (!smp_fetch_url32(args, smp, kw, private))