]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: lua: protects the upper boundary of the argument list for converters...
authorDavid Carlier <devnexen@gmail.com>
Wed, 27 Apr 2016 15:14:50 +0000 (16:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 29 Apr 2016 05:17:42 +0000 (07:17 +0200)
When a converter or sample is called from within a Lua code, there is a risk
of invalid argument string data usage when the upper boundary is reached.
Would be kind to port to 1.6 if possible.

src/hlua.c

index 4132ace7dab2a9f4953e41dceba4313066abbeae..221a7811b26fa81f4a3b4bd5e242a6815bfb3e00 100644 (file)
@@ -2954,6 +2954,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L)
                hlua_lua2arg(L, i + 2, &args[i]);
        }
        args[i].type = ARGT_STOP;
+       args[i].data.str.str = NULL;
 
        /* Check arguments. */
        MAY_LJMP(hlua_lua2arg_check(L, 2, args, f->arg_mask, hsmp->p));
@@ -3059,6 +3060,7 @@ __LJMP static int hlua_run_sample_conv(lua_State *L)
                hlua_lua2arg(L, i + 3, &args[i]);
        }
        args[i].type = ARGT_STOP;
+       args[i].data.str.str = NULL;
 
        /* Check arguments. */
        MAY_LJMP(hlua_lua2arg_check(L, 3, args, conv->arg_mask, hsmp->p));