summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_realip_module.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_realip_module.c b/src/http/modules/ngx_http_realip_module.c
index bd5c31cdc..ffb2028bf 100644
--- a/src/http/modules/ngx_http_realip_module.c
+++ b/src/http/modules/ngx_http_realip_module.c
@@ -163,10 +163,17 @@ ngx_http_realip_handler(ngx_http_request_t *r)
return NGX_DECLINED;
}
+ p = ngx_palloc(r->connection->pool, len);
+ if (p == NULL) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ ngx_memcpy(p, ip, len);
+
sin->sin_addr.s_addr = addr;
r->connection->addr_text.len = len;
- r->connection->addr_text.data = ip;
+ r->connection->addr_text.data = p;
return NGX_DECLINED;
}