From f2d31f829103aadff14178cf49ce0ae398af6c7a Mon Sep 17 00:00:00 2001 From: Vladimir Homutov Date: Thu, 13 Aug 2015 15:55:21 +0300 Subject: Stream: fixed potential error log buffer overrun. Found by Duan Jiong . --- src/stream/ngx_stream_handler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/stream/ngx_stream_handler.c') diff --git a/src/stream/ngx_stream_handler.c b/src/stream/ngx_stream_handler.c index 24afbcd35..b3edb684f 100644 --- a/src/stream/ngx_stream_handler.c +++ b/src/stream/ngx_stream_handler.c @@ -328,9 +328,11 @@ ngx_stream_log_error(ngx_log_t *log, u_char *buf, size_t len) p = ngx_snprintf(buf, len, ", client: %V, server: %V", &s->connection->addr_text, &s->connection->listening->addr_text); + len -= p - buf; + buf = p; if (s->log_handler) { - return s->log_handler(log, p, len); + p = s->log_handler(log, buf, len); } return p; -- cgit