Skip to content

Conversation

@bagder
Copy link
Member

@bagder bagder commented Jan 1, 2026

No description provided.

@bagder bagder added the MQTT label Jan 1, 2026
@bagder bagder marked this pull request as ready for review January 1, 2026 22:09
@bagder bagder requested a review from Copilot January 1, 2026 22:09
Copy link

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

This PR enhances error handling in the MQTT protocol implementation by modifying the mqtt_decode_len function to properly detect and report when a packet's variable-length encoding exceeds the MQTT specification's 4-byte limit. The function signature is changed from returning the decoded length directly to returning an error code, with the length passed via an output parameter.

Key changes:

  • Refactored mqtt_decode_len to return an error code (0 for success, non-zero for error) instead of the decoded length value
  • Added validation to reject packets that attempt to use more than 4 bytes for length encoding
  • Updated the call site to properly handle the new error return value

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

@bagder bagder closed this in 84e43ee Jan 1, 2026
@bagder bagder deleted the bagder/mqtt-too-large branch January 1, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant