[nginx] SSL: handled long string truncation in ngx_ssl_error().

Vladimir Homutov vl at nginx.com
Thu Oct 8 13:05:15 UTC 2015


details:   http://hg.nginx.org/nginx/rev/2f34ea503ac4
branches:  
changeset: 6259:2f34ea503ac4
user:      Vladimir Homutov <vl at nginx.com>
date:      Wed Oct 07 22:19:42 2015 +0300
description:
SSL: handled long string truncation in ngx_ssl_error().

If no space left in buffer after adding formatting symbols, error message
could be left without terminating null.  The fix is to output message using
actual length.

diffstat:

 src/event/ngx_event_openssl.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 4b4aee40c508 -r 2f34ea503ac4 src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c	Tue Oct 06 08:57:09 2015 +0300
+++ b/src/event/ngx_event_openssl.c	Wed Oct 07 22:19:42 2015 +0300
@@ -2045,7 +2045,7 @@ ngx_ssl_error(ngx_uint_t level, ngx_log_
         (void) ERR_get_error();
     }
 
-    ngx_log_error(level, log, err, "%s)", errstr);
+    ngx_log_error(level, log, err, "%*s)", p - errstr, errstr);
 }
 
 



More information about the nginx-devel mailing list