Fix MQTTSNPacket tests

This commit is contained in:
Ian Craggs
2017-06-30 15:39:31 +01:00
parent 1261bd0e45
commit 2754ad4bcd
2 changed files with 2 additions and 4 deletions

View File

@@ -202,7 +202,7 @@ int MQTTSNDeserialize_pingresp(unsigned char* buf, int buflen)
FUNC_ENTRY; FUNC_ENTRY;
curdata += MQTTSNPacket_decode(curdata, buflen, &mylen); /* read length */ curdata += MQTTSNPacket_decode(curdata, buflen, &mylen); /* read length */
enddata = buf + mylen; enddata = buf + mylen;
if (enddata - curdata < 2) if (enddata - curdata < 1)
goto exit; goto exit;
if (readChar(&curdata) != MQTTSN_PINGRESP) if (readChar(&curdata) != MQTTSN_PINGRESP)
@@ -475,5 +475,3 @@ exit:
FUNC_EXIT_RC(rc); FUNC_EXIT_RC(rc);
return rc; return rc;
} }

View File

@@ -378,7 +378,7 @@ int test1(struct Options options)
assert("good rc from deserialize disconnect", rc == 1, "rc was %d\n", rc); assert("good rc from deserialize disconnect", rc == 1, "rc was %d\n", rc);
/* data after should be the same as data before */ /* data after should be the same as data before */
assert("durations should be the same", 0 == duration_after, "durations were different\n", rc); assert("durations should be the same", -1 == duration_after, "durations were different\n", rc);
/* Disconnect with duration */ /* Disconnect with duration */
rc = MQTTSNSerialize_disconnect(buf, buflen, 33); rc = MQTTSNSerialize_disconnect(buf, buflen, 33);