diff --git a/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java b/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java index 079e875d..793a487b 100644 --- a/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java +++ b/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java @@ -137,7 +137,7 @@ protected WolfSSLEngineHelper(WolfSSLSession ssl, WolfSSLAuthStore store, WolfSSLParameters params, int port, String hostname) throws WolfSSLException { - if (params == null || ssl == null || store == null) { + if (params == null || ssl == null || store == null || port < 0) { throw new WolfSSLException("Bad argument"); } @@ -165,8 +165,7 @@ protected WolfSSLEngineHelper(WolfSSLSession ssl, WolfSSLAuthStore store, WolfSSLParameters params, int port, InetAddress peerAddr) throws WolfSSLException { - if (params == null || ssl == null || store == null || - peerAddr == null) { + if (params == null || ssl == null || store == null || peerAddr == null || port < 0) { throw new WolfSSLException("Bad argument"); }