Conversation
There was a problem hiding this comment.
Pull request overview
Addresses several wolfSSL static analyzer findings by hardening bounds checks and making comparisons constant-time.
Changes:
- Replaced ad-hoc payload skipping/string parsing with
GetSkip,GetString, andGetStringRefto add consistent bounds validation. - Updated password hash and public key fingerprint comparisons to use constant-time comparison.
- Simplified unsigned arithmetic to avoid invalid
< 0checks.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/wolfterm.c | Reworks unsigned math to remove invalid negative check flagged by static analysis. |
| src/internal.c | Uses shared parsing helpers (GetSkip/GetString/GetStringRef) to add bounds checks and reduce manual parsing. |
| apps/wolfsshd/auth.c | Switches to constant-time compares for password hash and CA key fingerprint checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
5458927 to
a66e564
Compare
a66e564 to
e643e69
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
e643e69 to
19202ea
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
In wolfSSHd, the comparisons of the password hash and public keys were using memcmp(). Changed to use ConstantCompare(). Affected functions: CheckPasswordHashUnix, CheckPublicKeyUnix. Issue: F-53
The DoIgnore() function was not bounds checking the ignore message. Changed it to use the GetSkip() function which does bounds checking and skips the current blob. Updated GetSkip() to allow 0 length blobs to skip. Affected function: DoIgnore. Issue: F-410
Replace the original message parsing functions with the GetStringRef() function, which does better bounds checking. Affected function: DoUserAuthRequestPassword. Issue: F-411
19202ea to
8a65d17
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Replace the original message parsing functions with the GetString() function, which does better bounds checking. Affected functions: DoServiceRequest, DoServiceAccept. Issue: F-524, F-525
8a65d17 to
6705bcf
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
For agent ECC public key parsing, replaced parsing the data by hand with the GetSkip() and GetStringRef() functions which do bounds checking. Affected function: PrepareUserAuthRequestEcc. Issue: F-526
When filling the screen with spaces, the code was subtracting two unsigned numbers and checking if they were negative. Changed to use a comparison and adjust the subtraction as appropriate, then did the rest of the size expansion. If the second point is before the first, set the fill length to 0. Affected function: wolfSSH_ClearScreen. Issue: F-48
6705bcf to
331048d
Compare
Fix some bugs found by the wolfSSL static analyzer: