DoProtoId: skip pre-version banner lines#959
Merged
padelsbach merged 1 commit intowolfSSL:masterfrom Apr 29, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates SSH protocol identification parsing to follow RFC 4253 §4.2 by allowing clients to skip pre-version banner lines (while servers reject them), with explicit caps to prevent banner-based stalling.
Changes:
- Add a configurable cap on pre-version banner lines (
WOLFSSH_MAX_BANNER_LINES) and persist a banner-line counter in handshake state. - Replace the previous identification line read logic with a line-oriented reader enforcing the 255-octet per-line limit and supporting CRLF/LF terminators.
- Add unit tests (including scripted non-blocking WANT_READ resumption) covering banner handling, limits, and error mappings.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
wolfssh/internal.h |
Adds WOLFSSH_MAX_BANNER_LINES, tracks banner line count in HandshakeInfo, and exposes wolfSSH_TestDoProtoId() for internal tests. |
src/internal.c |
Implements GetInputLine() (255-byte cap) and updates DoProtoId() to skip/limit banner lines per endpoint role and to be robust across WANT_READ retries. |
tests/unit.c |
Adds comprehensive DoProtoId unit tests plus a scripted IO recv mock to validate WANT_READ resumption and banner-line cap enforcement. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
padelsbach
reviewed
Apr 29, 2026
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #959
Scan targets checked: wolfssh-bugs, wolfssh-src
No new issues found in the changed files. ✅
1. Client skips non-SSH lines (RFC 4253 4.2); server rejects them 2. 255-byte per-line cap and 10-line cap (WOLFSSH_MAX_BANNER_LINES) 3. 28 test vectors plus scripted-IO mock for WANT_READ resumption Issue: F-606
padelsbach
approved these changes
Apr 29, 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.
Issue: F-606