From a4dfa7e2cb74bd5945a264e95843691631990197 Mon Sep 17 00:00:00 2001 From: Reda Chouk Date: Wed, 25 Sep 2024 19:42:33 +0200 Subject: [PATCH 1/2] Erroring out on invalid port during the creation of a SSLEngine --- src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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"); } From 58ffe8951edef2cebc6cf18f8f23c8d976ae7f96 Mon Sep 17 00:00:00 2001 From: Reda Chouk Date: Thu, 26 Sep 2024 10:57:55 +0200 Subject: [PATCH 2/2] 80 characters limit --- src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java b/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java index 793a487b..f3bd769d 100644 --- a/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java +++ b/src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java @@ -165,7 +165,8 @@ protected WolfSSLEngineHelper(WolfSSLSession ssl, WolfSSLAuthStore store, WolfSSLParameters params, int port, InetAddress peerAddr) throws WolfSSLException { - if (params == null || ssl == null || store == null || peerAddr == null || port < 0) { + if (params == null || ssl == null || store == null || + peerAddr == null || port < 0) { throw new WolfSSLException("Bad argument"); }