apps/wolfssh: fix ssh://hostname destination without explicit port#1006
apps/wolfssh: fix ssh://hostname destination without explicit port#1006yosuke-wolfssl wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes wolfssh destination parsing so ssh://hostname (and ssh://user@hostname) correctly sets config->hostname even when no explicit port is provided, aligning behavior with the documented command-line syntax and avoiding the downstream “client requires a hostname parameter” abort.
Changes:
- Refactors destination parsing into a new
ClientParseDestination()helper inapps/wolfssh/common.cand reuses it fromapps/wolfssh/wolfssh.c. - Ensures the URI form assigns
hostnamewhen host text exists and preserves the caller’s default port when no:portis present. - Adds regression tests covering URI and non-URI destination parsing variants, including malformed inputs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/regress.c | Adds regression coverage for destination parsing (issue 5575) and related edge cases. |
| apps/wolfssh/wolfssh.c | Replaces inline destination parsing with a call to ClientParseDestination(). |
| apps/wolfssh/common.h | Declares the new ClientParseDestination() helper. |
| apps/wolfssh/common.c | Implements ClientParseDestination() with commit-at-end semantics and memory handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
39eb164 to
44e9da7
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1006
Scan targets checked: none
Failed targets: wolfssh-bugs, wolfssh-src
Description
config_parse_command_line documents ssh://[user@]hostname[:port], but the URI branch only assigned config->hostname when an explicit :port was present. A normal wolfssh ssh://example.com (or ssh://user@example.com) left config->hostname == NULL, so wolfSSH_Client aborted with "client requires a hostname parameter" instead of connecting on the default port 22.
Addressed by f_5575.
Changes
A malformed destination with no host text (ssh://, ssh://user@) leaves hostname NULL so the existing downstream check rejects it cleanly.