Fix bug for prevent crash when access null pointer string. 75/10675/2
authorKIM JungYong <jyong2.kim@samsung.com>
Fri, 19 Aug 2016 13:04:18 +0000 (22:04 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 19 Aug 2016 13:58:11 +0000 (13:58 +0000)
When consumer receive responce of discovery,
we was compare uri of discovered resource with "notification".
But, sometime uri of discovered resource was null,
consumer service occur crash.
In this patch, protection code is added in discover result handling logic.

Change-Id: I9006a36874ea9e282031aa7f95609ac3ac307f02
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10675
Reviewed-by: Chihyun Cho <ch79.cho@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/notification/src/consumer/NSConsumerDiscovery.c

index 435430d..4277591 100644 (file)
@@ -111,6 +111,7 @@ OCStackApplicationResult NSProviderDiscoverListener(
     OCResourcePayload * resource = ((OCDiscoveryPayload *)clientResponse->payload)->resources;
     while (resource)
     {
+        NS_VERIFY_NOT_NULL(resource->uri, OC_STACK_KEEP_TRANSACTION);
         if (strstr(resource->uri, NS_RESOURCE_URI))
         {
             OCConnectivityType type = CT_DEFAULT;