Fix remaining length protection
This commit is contained in:
parent
af860133e8
commit
4daba0ae5c
@ -244,7 +244,7 @@ uint16_t PubSubClient::readPacket(uint8_t* lengthLength) {
|
|||||||
uint8_t start = 0;
|
uint8_t start = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (len == 6) {
|
if (len == 5) {
|
||||||
// Invalid remaining length encoding - kill the connection
|
// Invalid remaining length encoding - kill the connection
|
||||||
_state = MQTT_DISCONNECTED;
|
_state = MQTT_DISCONNECTED;
|
||||||
_client->stop();
|
_client->stop();
|
||||||
|
@ -174,8 +174,8 @@ int test_drop_invalid_remaining_length_message() {
|
|||||||
int rc = client.connect((char*)"client_test1");
|
int rc = client.connect((char*)"client_test1");
|
||||||
IS_TRUE(rc);
|
IS_TRUE(rc);
|
||||||
|
|
||||||
byte publish[] = {0x30,0x92,0x92,0x92,0x92,0x92,0x92,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64};
|
byte publish[] = {0x30,0x92,0x92,0x92,0x92,0x01,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64};
|
||||||
shimClient.respond(publish,21);
|
shimClient.respond(publish,20);
|
||||||
|
|
||||||
rc = client.loop();
|
rc = client.loop();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user