bugfix: ndk.set_var.DIRECTIVE had a memory issue and may pass empty argument values to the directive being called. thanks dannynoonan.
This commit is contained in:
Родитель
1eb73d67c1
Коммит
74755eb0e2
|
@ -75,6 +75,12 @@ ngx_http_lua_run_set_var_directive(lua_State *L)
|
|||
return luaL_error(L, "expecting one argument");
|
||||
}
|
||||
|
||||
#if 1
|
||||
ngx_memzero(&arg, sizeof(ngx_http_variable_value_t));
|
||||
|
||||
arg.valid = 1;
|
||||
#endif
|
||||
|
||||
arg.data = (u_char *) luaL_checklstring(L, 1, &len);
|
||||
arg.len = len;
|
||||
|
||||
|
|
20
t/018-ndk.t
20
t/018-ndk.t
|
@ -77,3 +77,23 @@ Foo: %20%25
|
|||
--- response_body
|
||||
hi
|
||||
|
||||
|
||||
|
||||
=== TEST 5: bug: ndk.set_var not initialize ngx_http_variable_value_t variable properly
|
||||
--- config
|
||||
location /luaset {
|
||||
content_by_lua "
|
||||
|
||||
local version = '2011.10.13+0000'
|
||||
local e_version = ndk.set_var.set_encode_base32(version)
|
||||
local s_version= ndk.set_var.set_quote_sql_str(version)
|
||||
ngx.say(e_version)
|
||||
ngx.say(s_version)
|
||||
";
|
||||
}
|
||||
--- request
|
||||
GET /luaset
|
||||
--- response_body
|
||||
68o32c9e64o2sc9j5co30c1g
|
||||
'2011.10.13+0000'
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче