packet length field is mal formed if length > 255 #19

Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
tomoaki
2016-07-27 16:18:29 +09:00
parent 464187a08b
commit 00d5552d30

View File

@@ -64,9 +64,9 @@ int MQTTSNPacket_encode(unsigned char* buf, int length)
FUNC_ENTRY; FUNC_ENTRY;
if (length > 255) if (length > 255)
{ {
buf[rc++] = 0x01; writeChar(&buf, 0x01);
writeInt(&buf, length); writeInt(&buf, length);
rc += 2; rc += 3;
} }
else else
buf[rc++] = length; buf[rc++] = length;