8211339: NPE during SSL handshake caused by HostnameChecker

Reviewed-by: xuelei
This commit is contained in:
Anthony Scarpino 2018-11-06 10:10:18 -08:00
parent 9ffe7e1205
commit f7fc720c9c
2 changed files with 286 additions and 0 deletions

View file

@ -92,6 +92,10 @@ public class HostnameChecker {
*/
public void match(String expectedName, X509Certificate cert,
boolean chainsToPublicCA) throws CertificateException {
if (expectedName == null) {
throw new CertificateException("Hostname or IP address is " +
"undefined.");
}
if (isIpAddress(expectedName)) {
matchIP(expectedName, cert);
} else {