From 512ec3a00782bc7bb372fab31a925f083b593258 Mon Sep 17 00:00:00 2001 From: "J.R. Lim" Date: Tue, 16 Jul 2024 11:20:27 -0700 Subject: [PATCH] Throw SSLException when hostname is null --- src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java b/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java index 50fc54c5..e0d7dd2d 100644 --- a/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java +++ b/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java @@ -871,7 +871,7 @@ private static boolean checkBooleanProperty(String prop, * name depending on what createSocket() API the user has called and with * what String. */ - private void setLocalServerNames() { + private void setLocalServerNames() throws SSLException { /* Do not add SNI if system property has been set to false */ boolean enableSNI = @@ -931,7 +931,9 @@ else if (this.hostname != null) { else { WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO, "hostname and peerAddr are null, not setting SNI"); - } + //throw an SSLException if the hostname is null + throw new SSLException("Hostname is null"); + } } } }