mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
Merge pull request #1831 from cesanta/mqtt
Accept zero-length payload messages
This commit is contained in:
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -3195,7 +3195,7 @@ int mg_mqtt_parse(const uint8_t *buf, size_t len, uint8_t version,
|
||||
m->id = (uint16_t) ((((uint16_t) p[0]) << 8) | p[1]);
|
||||
p += 2;
|
||||
}
|
||||
if (p >= end) return MQTT_MALFORMED;
|
||||
if (p > end) return MQTT_MALFORMED;
|
||||
if (version == 5) p += 1 + p[0]; // Skip options
|
||||
if (p > end) return MQTT_MALFORMED;
|
||||
m->data.ptr = (char *) p;
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ int mg_mqtt_parse(const uint8_t *buf, size_t len, uint8_t version,
|
||||
m->id = (uint16_t) ((((uint16_t) p[0]) << 8) | p[1]);
|
||||
p += 2;
|
||||
}
|
||||
if (p >= end) return MQTT_MALFORMED;
|
||||
if (p > end) return MQTT_MALFORMED;
|
||||
if (version == 5) p += 1 + p[0]; // Skip options
|
||||
if (p > end) return MQTT_MALFORMED;
|
||||
m->data.ptr = (char *) p;
|
||||
|
||||
Reference in new issue
Block a user