Skip to content

Commit

Permalink
Erroring out on invalid port during the creation of a SSLEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
gasbytes committed Sep 25, 2024
1 parent 1d1a4ed commit a4dfa7e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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");
}

Expand Down

0 comments on commit a4dfa7e

Please sign in to comment.