Skip to content

Conversation

brucemaclin
Copy link

@brucemaclin brucemaclin commented Mar 2, 2024

an invalid unsubscribe packet in base64 format "rS8BAAABAAAAAAAADGlvdC0wNDBhMDFrcARtcXR0BmlvdGh1YghhbGl5dW5jcwNjbw=="

if set maxcount to 1,and init topicFilters with size 1,*count will bigger than maxcount,topicFilters[*count] cause memory access violation.

Signed-off-by: brucemaclin <guozai12@gmail.com>
@CIPop
Copy link

CIPop commented Mar 4, 2024

We'll also need a UT for validation.

@CIPop CIPop self-assigned this Mar 4, 2024
@CIPop CIPop requested review from CIPop and icraggs March 4, 2024 19:48
Copy link

@CIPop CIPop left a comment

Choose a reason for hiding this comment

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

Comparison should be safer (>=) to cover other similar cases.
We would need a UT to exercise the new code.

*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.

brucemaclin and others added 2 commits March 5, 2024 12:25
Signed-off-by: brucemaclin <guozai12@gmail.com>
Signed-off-by: brucemaclin <guozai12@gmail12.com>
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.

2 participants