mqtt: verify that CONNACK has Remaining Length set to 2#20513
mqtt: verify that CONNACK has Remaining Length set to 2#20513
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds validation to ensure MQTT CONNACK packets have a Remaining Length field set to 2, as required by the MQTT v3.1.1 specification. This is an alternative implementation to PR #20503.
Changes:
- Added validation in
mqtt_verify_connack()to verify CONNACK Remaining Length equals 2 - Simplified error handling flow by replacing goto statements with early returns
- Added test infrastructure to allow test server to send malformed CONNACK packets
- Added test case to verify client correctly rejects CONNACK with incorrect Remaining Length
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/mqtt.c | Adds validation that CONNACK Remaining Length is 2 and simplifies error handling with early returns |
| tests/server/mqttd.c | Adds remlen_connack configuration option to test server for sending malformed CONNACK packets; reorders struct fields cosmetically |
| tests/data/test1132 | New test case verifying client rejects CONNACK with Remaining Length of 3 |
| tests/data/Makefile.am | Adds test1132 to the test suite |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
JimFuller-RedHat
left a comment
There was a problem hiding this comment.
LGTM (and good to see new test).
|
augment review |
🤖 Augment PR SummarySummary: Tightens MQTT protocol validation around CONNACK handling, with additional test coverage for malformed packets. Changes:
🤖 Was this summary useful? React with 👍 or 👎 |
|
@aisle-analyzer what do you think? |
🔒 Aisle Security Analysis✅ We scanned this PR and did not find any security vulnerabilities. Analyzed PR: #20513 at commit |
Alternative take to #20503