mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-12 23:16:51 +01:00
Fixing issue #72: Setting minimum message length to 2.
Signed-off-by: seko24 <seb12@mailbox.org>
This commit is contained in:
@@ -390,7 +390,7 @@ int MQTTSN::Client<Network, Timer, MAX_PACKET_SIZE, b>::readPacket(Timer& timer)
|
|||||||
int lenlen = 0;
|
int lenlen = 0;
|
||||||
int datalen = 0;
|
int datalen = 0;
|
||||||
|
|
||||||
#define MQTTSN_MIN_PACKET_LENGTH 3
|
#define MQTTSN_MIN_PACKET_LENGTH 2
|
||||||
// 1. read the packet, datagram style
|
// 1. read the packet, datagram style
|
||||||
if ((len = ipstack.read(readbuf, MAX_PACKET_SIZE, timer.left_ms())) < MQTTSN_MIN_PACKET_LENGTH)
|
if ((len = ipstack.read(readbuf, MAX_PACKET_SIZE, timer.left_ms())) < MQTTSN_MIN_PACKET_LENGTH)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ int MQTTSNstrlen(MQTTSNString MQTTSNString)
|
|||||||
int MQTTSNPacket_read(unsigned char* buf, int buflen, int (*getfn)(unsigned char*, int))
|
int MQTTSNPacket_read(unsigned char* buf, int buflen, int (*getfn)(unsigned char*, int))
|
||||||
{
|
{
|
||||||
int rc = MQTTSNPACKET_READ_ERROR;
|
int rc = MQTTSNPACKET_READ_ERROR;
|
||||||
const int MQTTSN_MIN_PACKET_LENGTH = 3;
|
const int MQTTSN_MIN_PACKET_LENGTH = 2;
|
||||||
int len = 0; /* the length of the whole packet including length field */
|
int len = 0; /* the length of the whole packet including length field */
|
||||||
int lenlen = 0;
|
int lenlen = 0;
|
||||||
int datalen = 0;
|
int datalen = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user