add null check when discovering 15/87215/1
authoryoungman <yman.jung@samsung.com>
Wed, 7 Sep 2016 05:13:12 +0000 (14:13 +0900)
committeryoungman <yman.jung@samsung.com>
Wed, 7 Sep 2016 05:13:12 +0000 (14:13 +0900)
Change-Id: I0055c5b61422d770261d8a46a3f34505d23921b0
Signed-off-by: youngman <yman.jung@samsung.com>
src/ic-ioty.c

index 2e2ecfe..660b231 100644 (file)
@@ -336,7 +336,8 @@ int icl_ioty_find_resource(const char *host_address,
 
        RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
 
-       if (IC_EQUAL != strncmp(IC_COAP_PREFIX, host_address, strlen(IC_COAP_PREFIX)))
+       if (host_address
+                       && IC_EQUAL != strncmp(IC_COAP_PREFIX, host_address, strlen(IC_COAP_PREFIX)))
                coap_str = IC_COAPS;
 
        if (NULL == host_address) {
@@ -415,7 +416,8 @@ int icl_ioty_find_device_info(const char *host_address,
 
        RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
 
-       if (IC_EQUAL != strncmp(IC_COAP_PREFIX, host_address, strlen(IC_COAP_PREFIX)))
+       if (host_address
+                       && IC_EQUAL != strncmp(IC_COAP_PREFIX, host_address, strlen(IC_COAP_PREFIX)))
                coap_str = IC_COAP;
 
        if (NULL == host_address)
@@ -490,7 +492,8 @@ int icl_ioty_find_platform_info(const char *host_address,
 
        RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
 
-       if (IC_EQUAL != strncmp(IC_COAP_PREFIX, host_address, strlen(IC_COAP_PREFIX)))
+       if (host_address
+                       && IC_EQUAL != strncmp(IC_COAP_PREFIX, host_address, strlen(IC_COAP_PREFIX)))
                coap_str = IC_COAP;
 
        if (NULL == host_address)