Check that the properties length isn't longer than the remaining packet data

This commit is contained in:
Ian Craggs 2026-07-13 12:50:34 +01:00
parent 5d5b1d2e26
commit 2260f5a5e0
No known key found for this signature in database
GPG Key ID: A7AE1A8F2CCAB186
1 changed files with 4 additions and 3 deletions

View File

@ -346,13 +346,14 @@ int MQTTProperties_read(MQTTProperties *properties, char **pptr, char *enddata)
int proplen = 0;
rc = MQTTPacket_decodeBuf(*pptr, enddata, (unsigned int*)&remlength);
if (rc > 0)
*pptr += rc;
else
if (rc <= 0 || !is_enough_data(pptr, enddata, remlength))
{
rc = MQTTPACKET_BUFFER_TOO_SHORT;
goto exit;
}
else
*pptr += rc;
properties->length = remlength;
while (remlength > 0)
{