Network: Fix character comparison for 8-bit values - #162
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes detection of 8-bit SMTP content when char is signed.
Changes:
- Casts character comparisons to
uint8_t. - Updates the copyright year.
Suppressed comments (1)
Components/Network/Source/net_smtp_client.c:826
- The new unsigned comparison sends signed high-bit bytes into this branch, but the following
sp[i] >> 4still operates on a negativechar. Its negative result is then used to indexhex_digit, causing an out-of-bounds read/undefined behavior. Use the unsigned byte value for both hexadecimal nibble lookups.
if (((uint8_t)sp[i] > 127) || (sp[i] == '=')) {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| continue; | ||
| } | ||
| if ((sp[j] > 127) || (sp[j] == '_') || (sp[j] == '=')) { | ||
| if (((uint8_t)sp[j] > 127) || (sp[j] == '_') || (sp[j] == '=')) { |
Co-authored-by: RobertRostohar <8438377+RobertRostohar@users.noreply.github.com>
RobertRostohar
approved these changes
Aug 20, 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.
No description provided.