[nginx] Stream: fixed potential error log buffer overrun.

Vladimir Homutov vl at nginx.com
Thu Aug 13 14:05:04 UTC 2015


details:   http://hg.nginx.org/nginx/rev/d1f94042c29c
branches:  
changeset: 6223:d1f94042c29c
user:      Vladimir Homutov <vl at nginx.com>
date:      Thu Aug 13 15:55:21 2015 +0300
description:
Stream: fixed potential error log buffer overrun.

Found by Duan Jiong <djduanjiong at gmail.com>.

diffstat:

 src/stream/ngx_stream_handler.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (16 lines):

diff -r 1bd5eb20bd7c -r d1f94042c29c src/stream/ngx_stream_handler.c
--- a/src/stream/ngx_stream_handler.c	Wed Aug 12 12:56:59 2015 +0300
+++ b/src/stream/ngx_stream_handler.c	Thu Aug 13 15:55:21 2015 +0300
@@ -328,9 +328,11 @@ ngx_stream_log_error(ngx_log_t *log, u_c
     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;



More information about the nginx-devel mailing list