Skip to content

Broker, client, and MQTT v5 packet validation and reliability fixes#552

Open
aidangarske wants to merge 31 commits into
masterfrom
fenrir-highmed-fixes
Open

Broker, client, and MQTT v5 packet validation and reliability fixes#552
aidangarske wants to merge 31 commits into
masterfrom
fenrir-highmed-fixes

Conversation

@aidangarske

@aidangarske aidangarske commented Jun 12, 2026

Copy link
Copy Markdown
Member

Description

F-3825, F-4050, F-4051, F-4052, F-4059, F-4244, F-4245, F-4246, F-4247, F-4249, F-4304, F-4305, F-4307,
F-4308, F-4529, F-4652, F-4653, F-4654, F-4655, F-4656, F-4657, F-4658, F-4722, F-4723, F-4724, F-4726,
F-4727, F-4729, F-4772, F-4773, F-4776, F-4777, F-4928, F-4929, F-4932, F-4933, F-4991, F-4992, F-4993,
F-4994, F-4996, F-4997,  F-5115, F-5116, F-5143, F-5148, F-5149, F-5512, F-5766, F-5767, F-5768, F-5769,
F-5771, F-5861, F-5862, F-5863, F-5865, F-4725, F-5144, F-4927

…ll re-entrancy, scoped wolfSSL cleanup, fan-out write reset
…roker publish, enforce retained cap on persist restore
Copilot AI review requested due to automatic review settings June 12, 2026 17:24

This comment was marked as resolved.

wolfSSL-Fenrir-bot

This comment was marked as resolved.

@embhorn embhorn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Couple minor things to clean up

MQTTCtx* mqttCtx = (MQTTCtx*)client->ctx;

/* Verify this message is for the firmware topic */
/* Verify this message is for the firmware topic. Compare against the full

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Too wordy for the example. Revert this comment to the original.

Certificate:
Data:
Version: 3 (0x2)
Version: 1 (0x0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did this change to V1 cert?

Comment thread src/mqtt_packet.c
while (((int)prop_len > 0) && (rc >= 0))
{
/* Bound the number of properties a single message may carry so a peer
* cannot saturate the shared property pool (CWE-770). */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove the CWE reference

MqttBroker_Free(&broker);
}

/* [CWE-863/CWE-639] An unauthenticated CONNECT must not mutate another

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove the CWE reference

Comment thread src/mqtt_broker.c
if (broker->retained_delivering > 0) {
/* A delivery loop is iterating this list (possibly re-entered
* via a WebSocket fan-out). Freeing now would invalidate that
* loop's saved next pointer (CWE-416); flag for deferred reap

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove the CWE reference

Comment thread tests/test_mqtt_packet.c
ASSERT_NULL(pub.props);
}

/* [CWE-770] A single message may not carry more than the internal

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove CWE reference

Comment thread tests/test_mqtt_packet.c
ASSERT_TRUE(rc > 0);
}

/* [CWE-125] The encoder must clamp the copied payload to buffer_len so a

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove CWE reference

#endif /* WOLFMQTT_BROKER_RETAINED && !WOLFMQTT_STATIC_MEMORY */

#ifndef WOLFMQTT_STATIC_MEMORY
/* [CWE-770] A single client cannot occupy more than BROKER_MAX_SUBS_PER_CLIENT

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove CWE reference

}

#if defined(WOLFMQTT_BROKER_RETAINED) && !defined(WOLFMQTT_STATIC_MEMORY)
/* [CWE-400] The dynamic retained-message list must be bounded. A client that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove CWE reference

Comment thread tests/test_mqtt_client.c
return n;
}

/* [issue 3129] A broker that rejects a subscription returns a SUBACK whose

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove issue numbers

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