]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http_fetch: Make sure name is initialized before http_find_header.
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 21 Nov 2018 12:49:48 +0000 (13:49 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 22 Nov 2018 09:09:58 +0000 (10:09 +0100)
Before calling http_find_header, make sure name is initialized properly, or
its value would be random.

src/http_fetch.c

index f8dfe335c946939f47b4b5a03d5c8a9455738729..56c6a2bf90323c961517a2cdf78aba66661f9d7b 100644 (file)
@@ -1165,6 +1165,9 @@ static int smp_fetch_fhdr_cnt(const struct arg *args, struct sample *smp, const
                if (args && args->type == ARGT_STR) {
                        name.ptr = args->data.str.area;
                        name.len = args->data.str.data;
+               } else {
+                       name.ptr = NULL;
+                       name.len = 0;
                }
 
                ctx.blk = NULL;
@@ -1390,6 +1393,9 @@ static int smp_fetch_hdr_cnt(const struct arg *args, struct sample *smp, const c
                if (args && args->type == ARGT_STR) {
                        name.ptr = args->data.str.area;
                        name.len = args->data.str.data;
+               } else {
+                       name.ptr = NULL;
+                       name.len = 0;
                }
 
                ctx.blk = NULL;