SSL: explicit handling of empty names.
X509_check_host() can't handle non null-terminated names with zero length,
so make sure to fail before calling it.
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index f885a5c..88472fc 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -2504,6 +2504,10 @@
/* X509_check_host() is only available in OpenSSL 1.0.2+ */
+ if (name->len == 0) {
+ goto failed;
+ }
+
if (X509_check_host(cert, name->data, name->len, 0) != 1) {
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
"X509_check_host(): no match");