diff options
author | Roman Arutyunyan <arut@nginx.com> | 2016-09-01 14:33:51 +0300 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2016-09-01 14:33:51 +0300 |
commit | c6ba4aae38af53a378a57fd196fe32ccb3b4131d (patch) | |
tree | 3da59103d529c7ef8c93e68d98d37a36309f5550 /src | |
parent | 048ee941302b5476dc69cca6169e03722a2000f5 (diff) | |
download | nginx-c6ba4aae38af53a378a57fd196fe32ccb3b4131d.tar.gz nginx-c6ba4aae38af53a378a57fd196fe32ccb3b4131d.zip |
Realip: fixed uninitialized memory access.
Previously, the realip module could be left with uninitialized context after an
error in the ngx_http_realip_set_addr() function. That context could be later
accessed by $realip_remote_addr and $realip_remote_port variable handlers.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/ngx_http_realip_module.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_realip_module.c b/src/http/modules/ngx_http_realip_module.c index 490a53d0e..dba3c527b 100644 --- a/src/http/modules/ngx_http_realip_module.c +++ b/src/http/modules/ngx_http_realip_module.c @@ -264,7 +264,6 @@ ngx_http_realip_set_addr(ngx_http_request_t *r, ngx_addr_t *addr) } ctx = cln->data; - ngx_http_set_ctx(r, ctx, ngx_http_realip_module); c = r->connection; @@ -282,6 +281,7 @@ ngx_http_realip_set_addr(ngx_http_request_t *r, ngx_addr_t *addr) ngx_memcpy(p, text, len); cln->handler = ngx_http_realip_cleanup; + ngx_http_set_ctx(r, ctx, ngx_http_realip_module); ctx->connection = c; ctx->sockaddr = c->sockaddr; |