to add check CoAP version
authorjihwan.seo <jihwan.seo@samsung.com>
Fri, 14 Aug 2015 05:36:58 +0000 (14:36 +0900)
committerJon A. Cruz <jonc@osg.samsung.com>
Mon, 17 Aug 2015 18:24:47 +0000 (18:24 +0000)
there was no check CoAP version.
it has to check by spec

Change-Id: I485779a0aef88cb18369f5b1842f06d19eadddcd
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2206
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
resource/csdk/connectivity/src/caprotocolmessage.c

index a418a03..b140264 100644 (file)
@@ -229,6 +229,14 @@ coap_pdu_t *CAParsePDU(const char *data, uint32_t length, uint32_t *outCode)
         return NULL;
     }
 
+    if (outpdu->hdr->version != COAP_DEFAULT_VERSION)
+    {
+        OIC_LOG_V(ERROR, TAG, "coap version is not available : %d",
+                  outpdu->hdr->version);
+        coap_delete_pdu(outpdu);
+        return NULL;
+    }
+
     if (outCode)
     {
         (*outCode) = (uint32_t) CA_RESPONSE_CODE(outpdu->hdr->code);