mirror of https://github.com/eclipse/paho.mqtt.c
Check that the properties length isn't longer than the remaining packet data
This commit is contained in:
parent
5d5b1d2e26
commit
2260f5a5e0
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue