[JIRA IOT-737] fixed to prevent send coap pdu for no uri
authorjihwan.seo <jihwan.seo@samsung.com>
Thu, 24 Sep 2015 11:31:13 +0000 (20:31 +0900)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Fri, 25 Sep 2015 15:59:14 +0000 (15:59 +0000)
if some case is need it to check. the case have to check it.
pdu have to be passed even though there is no uri.

Change-Id: I95ba9b2bb64f7733fcfb3d06b896032c0e3feeef
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3041
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
resource/csdk/connectivity/src/caprotocolmessage.c

index 67dbdba..382c090 100644 (file)
@@ -146,16 +146,9 @@ coap_pdu_t *CAGeneratePDU(uint32_t code, const CAInfo_t *info, const CAEndpoint_
     {
         coap_list_t *optlist = NULL;
 
-        if (CA_MSG_ACKNOWLEDGE != info->type)
+        if (CA_MSG_ACKNOWLEDGE != info->type && info->resourceUri)
         {
-            const char *uri = info->resourceUri;
-            if (NULL == uri)
-            {
-                OIC_LOG(ERROR, TAG, "uri NULL");
-                return NULL;
-            }
-
-            uint32_t length = strlen(uri);
+            uint32_t length = strlen(info->resourceUri);
             if (CA_MAX_URI_LENGTH < length)
             {
                 OIC_LOG(ERROR, TAG, "URI len err");
@@ -170,7 +163,7 @@ coap_pdu_t *CAGeneratePDU(uint32_t code, const CAInfo_t *info, const CAEndpoint_
                 return NULL;
             }
             OICStrcat(coapUri, uriLength, COAP_URI_HEADER);
-            OICStrcat(coapUri, uriLength, uri);
+            OICStrcat(coapUri, uriLength, info->resourceUri);
 
             // parsing options in URI
             CAResult_t res = CAParseURI(coapUri, &optlist);