Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MQTTPacket/src/MQTTUnsubscribeServer.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ int32_t MQTTDeserialize_unsubscribe(unsigned char* dup, unsigned short* packetid
*count = 0;
while (curdata < enddata)
{
if (*count == maxcount)
Copy link

Choose a reason for hiding this comment

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

>= is safer.

Also, we'll need to scan all other APIs for possible similar issues.

Copy link
Author

Choose a reason for hiding this comment

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

change to >=.But in MQTTV5Deserialize_subscribe,it use *count == maxcount to check.

goto exit;
if (!readMQTTLenString(&topicFilters[*count], &curdata, enddata))
goto exit;
(*count)++;
Expand Down