diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c index 1d2d1efd9..f885a5c7f 100644 --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -2637,6 +2637,11 @@ ngx_ssl_check_name(ngx_str_t *name, ASN1_STRING *pattern) end = s + slen; s = ngx_strlchr(s, end, '.'); + + if (s == NULL) { + return NGX_ERROR; + } + slen = end - s; if (plen == slen && ngx_strncasecmp(s, p, plen) == 0) {