diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2019-07-12 15:35:31 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2019-07-12 15:35:31 +0300 |
commit | cae2e689083a04b2ddbb93bef5313b136080df65 (patch) | |
tree | 01f68ae8abb66a0969a3702df9f84f04278614bc /src/http/modules/perl/ngx_http_perl_module.c | |
parent | 19887831698e18149a45a8b9563e8fdcdaaea211 (diff) | |
download | nginx-cae2e689083a04b2ddbb93bef5313b136080df65.tar.gz nginx-cae2e689083a04b2ddbb93bef5313b136080df65.zip |
Perl: disabled unrelated calls from variable handlers.
Variable handlers are not expected to send anything to the client, cannot
sleep or read body, and are not expected to modify the request. Added
appropriate protection to prevent accidental foot shooting.
Diffstat (limited to 'src/http/modules/perl/ngx_http_perl_module.c')
-rw-r--r-- | src/http/modules/perl/ngx_http_perl_module.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c index ac6a7a2a3..a383e9002 100644 --- a/src/http/modules/perl/ngx_http_perl_module.c +++ b/src/http/modules/perl/ngx_http_perl_module.c @@ -302,6 +302,7 @@ ngx_http_perl_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, ngx_int_t rc; ngx_str_t value; + ngx_uint_t saved; ngx_http_perl_ctx_t *ctx; ngx_http_perl_main_conf_t *pmcf; @@ -321,6 +322,9 @@ ngx_http_perl_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, ctx->request = r; } + saved = ctx->variable; + ctx->variable = 1; + pmcf = ngx_http_get_module_main_conf(r, ngx_http_perl_module); value.data = NULL; @@ -347,6 +351,7 @@ ngx_http_perl_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, v->not_found = 1; } + ctx->variable = saved; ctx->filename.data = NULL; ctx->redirect_uri.len = 0; |