Skip to content

Always check MqttDecode_Num's return code.#479

Merged
embhorn merged 2 commits intowolfSSL:masterfrom
kareem-wolfssl:zd21518
Apr 27, 2026
Merged

Always check MqttDecode_Num's return code.#479
embhorn merged 2 commits intowolfSSL:masterfrom
kareem-wolfssl:zd21518

Conversation

@kareem-wolfssl
Copy link
Copy Markdown
Contributor

Thanks to Weiheng Qiu for the report.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves MQTT-SN packet decoding robustness by consistently checking and acting on MqttDecode_Num() return codes during header/field parsing.

Changes:

  • Capture MqttDecode_Num() return values and return early on negative error codes across multiple MQTT-SN decode paths.
  • Use the decoded byte-count to advance payload pointers instead of assuming decode success.
  • Add return-code handling for extended-length decoding during SN packet reads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/mqtt_sn_packet.c
Comment thread src/mqtt_sn_packet.c
Comment thread src/mqtt_sn_packet.c
Comment thread src/mqtt_sn_packet.c Outdated
Comment thread src/mqtt_sn_packet.c Outdated
Comment thread src/mqtt_sn_packet.c Outdated
Copy link
Copy Markdown
Member

@embhorn embhorn left a comment

Choose a reason for hiding this comment

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

See copilot feedback about double semi-colon.

Rebase and the failing websocket test should pass.

Comment thread src/mqtt_sn_packet.c Outdated
Thanks to Weiheng Qiu for the report.
Copy link
Copy Markdown
Member

@embhorn embhorn left a comment

Choose a reason for hiding this comment

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

Skoll Code Review

Scan type: review
Overall recommendation: APPROVE
Findings: 2 total — 2 posted, 0 skipped
2 finding(s) posted as inline comments (see file-level comments below)

Posted findings

  • [Low] New buf_len pre-checks in SN_Decode_Header don't account for rx_buf advancement / long-header formsrc/mqtt_sn_packet.c:132-164
  • [Info] Whitespace cleanup unrelated to the stated fixsrc/mqtt_sn_packet.c:1469

Review generated by Skoll

Comment thread src/mqtt_sn_packet.c
Comment thread src/mqtt_sn_packet.c
@embhorn embhorn self-requested a review April 27, 2026 14:44
@embhorn embhorn merged commit c08b73f into wolfSSL:master Apr 27, 2026
36 checks passed
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.

3 participants