Skip to content

Commit

Permalink
Fix fuzzer issues
Browse files Browse the repository at this point in the history
  • Loading branch information
embhorn committed Nov 29, 2023
1 parent 8f5cd9c commit bb97f43
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/mqtt_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,16 +605,20 @@ int MqttDecode_Props(MqttPacketType packet, MqttProp** props, byte* pbuf,
buf += tmp;
total += tmp;
prop_len -= (word32)tmp;

tmp = MqttDecode_String(buf,
(const char**)&cur_prop->data_str2.str,
&cur_prop->data_str2.len);
if (cur_prop->data_str2.len <=
(buf_len - (buf - pbuf))) {
buf += tmp;
total += tmp;
prop_len -= (word32)tmp;
}
if ((buf_len - (buf - pbuf)) > 0) {
tmp = MqttDecode_String(buf,
(const char**)&cur_prop->data_str2.str,
&cur_prop->data_str2.len);
if (cur_prop->data_str2.len <=
(buf_len - (buf - pbuf))) {
buf += tmp;
total += tmp;
prop_len -= (word32)tmp;
}
else {
/* Invalid length */
rc = MQTT_TRACE_ERROR(MQTT_CODE_ERROR_PROPERTY);
}
else {
/* Invalid length */
rc = MQTT_TRACE_ERROR(MQTT_CODE_ERROR_PROPERTY);
Expand Down

0 comments on commit bb97f43

Please sign in to comment.