summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2018-03-01 18:38:39 +0300
committerRoman Arutyunyan <arut@nginx.com>2018-03-01 18:38:39 +0300
commit6e30556127157ddf04e925480ce1e0ef9df2ca0a (patch)
tree89fb6e3628742f5500713fd1d6141034493ae366 /src
parent7c5c15a25d22b05f1baabfb14395a7924fe4fd8c (diff)
downloadnginx-6e30556127157ddf04e925480ce1e0ef9df2ca0a.tar.gz
nginx-6e30556127157ddf04e925480ce1e0ef9df2ca0a.tar.bz2
Postpone filter: prevented uninitialized r->out.
The r->out chain link could be left uninitialized in case of error. A segfault could happen if the subrequest handler accessed it. The issue was introduced in commit 20f139e9ffa8.
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_postpone_filter_module.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/http/ngx_http_postpone_filter_module.c b/src/http/ngx_http_postpone_filter_module.c
index ded70b31b..599d263e5 100644
--- a/src/http/ngx_http_postpone_filter_module.c
+++ b/src/http/ngx_http_postpone_filter_module.c
@@ -191,11 +191,6 @@ ngx_http_postpone_filter_in_memory(ngx_http_request_t *r, ngx_chain_t *in)
"http postpone filter in memory");
if (r->out == NULL) {
- r->out = ngx_alloc_chain_link(r->pool);
- if (r->out == NULL) {
- return NGX_ERROR;
- }
-
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
if (r->headers_out.content_length_n != -1) {
@@ -218,6 +213,11 @@ ngx_http_postpone_filter_in_memory(ngx_http_request_t *r, ngx_chain_t *in)
b->last_buf = 1;
+ r->out = ngx_alloc_chain_link(r->pool);
+ if (r->out == NULL) {
+ return NGX_ERROR;
+ }
+
r->out->buf = b;
r->out->next = NULL;
}