Fix fuzzer use-after-poison READ 1

This commit is contained in:
cpq committed 2022-11-11 15:03:48 +00:00
1 parent cab5c822c5
commit a39b7ddbac
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -173,7 +173,7 @@ int mg_mqtt_parse(const uint8_t *buf, size_t len, uint8_t version,
p += 2;
}
if (p > end) return MQTT_MALFORMED;
if (version == 5 && p + 1 < end) p += 1 + p[0]; // Skip options
if (version == 5 && p + 2 < end) p += 1 + p[0]; // Skip options
if (p > end) return MQTT_MALFORMED;
m->data.ptr = (char *) p;
m->data.len = (size_t) (end - p);