From 2a2c87398740af7962b839962532c005c5185c71 Mon Sep 17 00:00:00 2001 From: "hyuna0213.jo" Date: Thu, 10 Dec 2015 00:51:10 +0000 Subject: [PATCH] fixed CoAP/TCP header type check logic from the size. The first nibble of coap over tcp message format is used to indicate the length of the options/payload. if the first nibble is 13, An 8-bit unsigned integer follows the initial byte and indicates the length of options/payload minus 13. (14: 16-bit unsigned integer, indicates the length of options/payload minus 269. 15: 32-bit unsigned interger, indicates the length of options/payload minus 65805) Change-Id: I2a88eb161584fb0104d2b533e3456c19a4b99304 Signed-off-by: hyuna0213.jo Reviewed-on: https://gerrit.iotivity.org/gerrit/4479 Tested-by: jenkins-iotivity Reviewed-by: Jon A. Cruz --- resource/csdk/connectivity/lib/libcoap-4.1.1/pdu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resource/csdk/connectivity/lib/libcoap-4.1.1/pdu.c b/resource/csdk/connectivity/lib/libcoap-4.1.1/pdu.c index e4f40d6..3086b22 100644 --- a/resource/csdk/connectivity/lib/libcoap-4.1.1/pdu.c +++ b/resource/csdk/connectivity/lib/libcoap-4.1.1/pdu.c @@ -245,15 +245,15 @@ void coap_delete_pdu(coap_pdu_t *pdu) #ifdef WITH_TCP coap_transport_type coap_get_tcp_header_type_from_size(unsigned int size) { - if (COAP_TCP_LENGTH_LIMIT_8_BIT < size && COAP_TCP_LENGTH_LIMIT_16_BIT >= size) + if (COAP_TCP_LENGTH_FIELD_8_BIT < size && COAP_TCP_LENGTH_FIELD_16_BIT >= size) { return coap_tcp_8bit; } - else if (COAP_TCP_LENGTH_LIMIT_16_BIT < size && COAP_TCP_LENGTH_LIMIT_32_BIT >= size) + else if (COAP_TCP_LENGTH_FIELD_16_BIT < size && COAP_TCP_LENGTH_FIELD_32_BIT >= size) { return coap_tcp_16bit; } - else if (COAP_TCP_LENGTH_LIMIT_32_BIT < size) + else if (COAP_TCP_LENGTH_FIELD_32_BIT < size) { return coap_tcp_32bit; } -- 2.7.4