# HG changeset patch # User Roman Arutyunyan # Date 1472729631 -10800 # Node ID 6b1b8c4b7a95d23b74746fd87909c6933643ea7d # Parent c6372a40c2a731d8816160bf8f55a7a50050c2ac 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. diff -r c6372a40c2a7 -r 6b1b8c4b7a95 src/http/modules/ngx_http_realip_module.c --- a/src/http/modules/ngx_http_realip_module.c Fri Aug 26 15:33:07 2016 +0300 +++ b/src/http/modules/ngx_http_realip_module.c Thu Sep 01 14:33:51 2016 +0300 @@ -264,7 +264,6 @@ } ctx = cln->data; - ngx_http_set_ctx(r, ctx, ngx_http_realip_module); c = r->connection; @@ -282,6 +281,7 @@ 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;