Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for empty topic filters in subscribes #139

Merged
merged 1 commit into from
Dec 11, 2020

Conversation

muneebahmed10
Copy link
Contributor

Description:
Serializing a SUBSCRIBE or UNSUBSCRIBE packet using either the managed or serializer API will not return an error if zero length topic filter is passed. This adds a check to calculateSubscriptionPacketSize, used by MQTT_GetSubscribePacketSize and MQTT_GetUnsubscribePacketSize, to validate the topic length of each filter. Since MQTT_Subscribe internally calls MQTT_GetSubscribePacketSize, a bad parameter error code will be propagated back if an invalid topic filter length is passed.

Side note: This change resulted in the GNU complexity of calculateSubscriptionPacketSize increasing from 3 to 6. While this is still under our limit, it's concerning that complexity doubled due to what amounts to an if statement and setting a return code.

@muneebahmed10 muneebahmed10 merged commit 096ec21 into FreeRTOS:main Dec 11, 2020
@muneebahmed10 muneebahmed10 deleted the validate-subscribe-param branch December 11, 2020 09:26
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.

None yet

3 participants