]> git.kaiwu.me - nginx.git/commitdiff
SSL: fixed possible segfault on renegotiation (ticket #845).
authorSergey Kandaurov <pluknet@nginx.com>
Tue, 8 Dec 2015 13:59:43 +0000 (16:59 +0300)
committerSergey Kandaurov <pluknet@nginx.com>
Tue, 8 Dec 2015 13:59:43 +0000 (16:59 +0300)
Skip SSL_CTX_set_tlsext_servername_callback in case of renegotiation.
Do nothing in SNI callback as in this case it will be supplied with
request in c->data which isn't expected and doesn't work this way.

This was broken by b40af2fd1c16 (1.9.6) with OpenSSL master branch and LibreSSL.

src/http/ngx_http_request.c

index b68a13d3acce2fda672683aac0a73e728cc7a860..99e9325099cd1a969120870018aaa3a948015c0f 100644 (file)
@@ -837,6 +837,10 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
 
     c = ngx_ssl_get_connection(ssl_conn);
 
+    if (c->ssl->renegotiation) {
+        return SSL_TLSEXT_ERR_NOACK;
+    }
+
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
                    "SSL server name: \"%s\"", servername);