Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erroring out on invalid port during the creation of a SSLEngine #224

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where possible, we still try to conform to our 80-character max line length in the Java wrappers. Can you wrap this line around? Looks just a little too long.

throw new WolfSSLException("Bad argument");
}

Expand Down