wolfSSH_get_fd: return socket sentinel on NULL - #1247
Merged
Merged
Conversation
- Return -1 on both (Windows build and not), the sentinel wolfSSH_new() uses for rfd/wfd.
ejohnstown
requested review from
wolfSSL-Fenrir-bot
and
a lite review from Copilot
September 10, 2026 22:48
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1247
Scan targets checked: wolfssh-src, wolfssh-bugs
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Add regression coverage for the invalid-socket sentinel behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates wolfSSH_get_fd() to return the platform’s invalid socket sentinel for NULL sessions.
Changes:
- Returns
INVALID_SOCKETon Windows and-1elsewhere. - Aligns behavior with socket initialization in
wolfSSH_new(). - Moderate finding: add a regression assertion for the platform invalid-socket sentinel.
File summaries
| File | Summary |
|---|---|
src/ssh.c |
Adjusts NULL-session socket handling. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
test_wolfSSH_set_fd() compares the NULL return of wolfSSH_get_fd() against the platform invalid-socket sentinel, the value wolfSSH_new() initializes rfd/wfd to. The old check only asserted the result was not WS_SUCCESS, which the previous WS_BAD_ARGUMENT return also satisfied.
padelsbach
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while updating the wolfSSH manual.
wolfSSH_get_fd()returns aWS_SOCKET_T, but on a NULLsshthe non-Windows build returned the error enumWS_BAD_ARGUMENT(-1002), which is not a socket value.wolfSSH_new()initializesrfd/wfdto, so both builds hand back a value callers can compare as a socket.