Skip to content

Network: Fix character comparison for 8-bit values - #162

Merged
RobertRostohar merged 2 commits into
mainfrom
codeql_fix
Aug 20, 2026
Merged

Network: Fix character comparison for 8-bit values#162
RobertRostohar merged 2 commits into
mainfrom
codeql_fix

Conversation

@furbanc

@furbanc furbanc commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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] >> 4 still operates on a negative char. Its negative result is then used to index hex_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
RobertRostohar merged commit 5550fcc into main Aug 20, 2026
4 checks passed
@RobertRostohar
RobertRostohar deleted the codeql_fix branch August 20, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants