Skip to content

Commit a4dfa7e

Browse files
committed
Erroring out on invalid port during the creation of a SSLEngine
1 parent 1d1a4ed commit a4dfa7e

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/java/com/wolfssl/provider/jsse/WolfSSLEngineHelper.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ protected WolfSSLEngineHelper(WolfSSLSession ssl, WolfSSLAuthStore store,
137137
WolfSSLParameters params, int port, String hostname)
138138
throws WolfSSLException {
139139

140-
if (params == null || ssl == null || store == null) {
140+
if (params == null || ssl == null || store == null || port < 0) {
141141
throw new WolfSSLException("Bad argument");
142142
}
143143

@@ -165,8 +165,7 @@ protected WolfSSLEngineHelper(WolfSSLSession ssl, WolfSSLAuthStore store,
165165
WolfSSLParameters params, int port, InetAddress peerAddr)
166166
throws WolfSSLException {
167167

168-
if (params == null || ssl == null || store == null ||
169-
peerAddr == null) {
168+
if (params == null || ssl == null || store == null || peerAddr == null || port < 0) {
170169
throw new WolfSSLException("Bad argument");
171170
}
172171

0 commit comments

Comments
 (0)