]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http: fix the url_param fetch
authorDragan Dosen <ddosen@haproxy.com>
Mon, 25 May 2015 08:02:11 +0000 (10:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 May 2015 17:01:39 +0000 (19:01 +0200)
The "name" and "name_len" arguments in function "smp_fetch_url_param"
could be left uninitialized for subsequent calls.

[wt: no backport needed, this is an 1.6 regression introduced by
 commit 4fdc74c ("MINOR: http: split the url_param in two parts") ]

src/proto_http.c

index fa3be6a917091fe4634cc81cf82fc1f65cf356f2..3d41c562b2f4dfe0d4660ad538ac2810b6416422 100644 (file)
@@ -11762,22 +11762,22 @@ smp_fetch_url_param(const struct arg *args, struct sample *smp, const char *kw,
        const char *name;
        int name_len;
 
-       if (!smp->ctx.a[0]) { // first call, find the query string
-               if (!args ||
-                   (args[0].type && args[0].type != ARGT_STR) ||
-                   (args[1].type && args[1].type != ARGT_STR))
-                       return 0;
+       if (!args ||
+           (args[0].type && args[0].type != ARGT_STR) ||
+           (args[1].type && args[1].type != ARGT_STR))
+               return 0;
 
-               if (args[1].type)
-                       delim = *args[1].data.str.str;
+       name = "";
+       name_len = 0;
+       if (args->type == ARGT_STR) {
+               name     = args->data.str.str;
+               name_len = args->data.str.len;
+       }
 
-               name = "";
-               name_len = 0;
-               if (args->type == ARGT_STR) {
-                       name     = args->data.str.str;
-                       name_len = args->data.str.len;
-               }
+       if (args[1].type)
+               delim = *args[1].data.str.str;
 
+       if (!smp->ctx.a[0]) { // first call, find the query string
                CHECK_HTTP_MESSAGE_FIRST();
 
                msg = &smp->strm->txn->req;