Modified to check Payload for TCP
authorjihwan.seo <jihwan.seo@samsung.com>
Tue, 6 Oct 2015 04:47:13 +0000 (13:47 +0900)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Tue, 6 Oct 2015 15:47:29 +0000 (15:47 +0000)
to check payload have to contain option data.

Change-Id: Ib8d1cb9946cd1e4723531de986129e8e30f32c09
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3569
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
resource/csdk/connectivity/src/tcp_adapter/catcpserver.c

index 64db605..74c800e 100644 (file)
@@ -639,7 +639,10 @@ static size_t CACheckPayloadLength(const void *data, size_t dlen)
     }
 
     size_t payloadLen = 0;
-    if (pdu->data)
+    size_t headerSize = coap_get_tcp_header_length_for_transport(transport);
+    OIC_LOG_V(DEBUG, TAG, "headerSize : %d, pdu length : %d",
+              headerSize, pdu->length);
+    if (pdu->length > headerSize)
     {
         payloadLen = (unsigned char *) pdu->hdr + pdu->length - pdu->data;
     }