]> git.kaiwu.me - nginx.git/commitdiff
Stream: fixed handling of non-ssl sessions.
authorVladimir Homutov <vl@nginx.com>
Thu, 19 Jan 2017 13:17:05 +0000 (16:17 +0300)
committerVladimir Homutov <vl@nginx.com>
Thu, 19 Jan 2017 13:17:05 +0000 (16:17 +0300)
A missing check could cause ngx_stream_ssl_handler() to be applied
to a non-ssl session, which resulted in a null pointer dereference
if ssl_verify_client is enabled.

The bug had appeared in 1.11.8 (41cb1b64561d).

src/stream/ngx_stream_ssl_module.c

index fb653c57c92e29bb4a0bd09369fa7236da9791ff..414d32824ecbefd5740647ebeb1b07e34e5ce9bc 100644 (file)
@@ -287,11 +287,15 @@ ngx_stream_ssl_handler(ngx_stream_session_t *s)
     ngx_connection_t       *c;
     ngx_stream_ssl_conf_t  *sslcf;
 
+    if (!s->ssl) {
+        return NGX_OK;
+    }
+
     c = s->connection;
 
     sslcf = ngx_stream_get_module_srv_conf(s, ngx_stream_ssl_module);
 
-    if (s->ssl && c->ssl == NULL) {
+    if (c->ssl == NULL) {
         c->log->action = "SSL handshaking";
 
         if (sslcf->ssl.ctx == NULL) {