Fix bug for invaild parse mediaContents.
authorKIM JungYong <jyong2.kim@samsung.com>
Tue, 27 Sep 2016 13:14:59 +0000 (22:14 +0900)
committerUze Choi <uzchoi@samsung.com>
Thu, 29 Sep 2016 07:35:21 +0000 (07:35 +0000)
When consumer service receive message and parse mediaContents,
sometime app crashed cause by mediaContents consist in the payload but this value is invalid.
In this patch, added logic for check to consist and correct mediaContents.

Change-Id: Iff2be18efce2697843ea5c73074ada72d2eb751b
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12339
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
(cherry picked from commit b6001c6ac167769f20c8b1eb4dc84e18c32264b0)
Reviewed-on: https://gerrit.iotivity.org/gerrit/12455

service/notification/src/consumer/NSConsumerCommunication.c

index afde612..2c0da66 100644 (file)
@@ -253,7 +253,7 @@ NSMessage * NSGetMessage(OCClientResponse * clientResponse)
     char * icon = NULL;
     OCRepPayloadGetPropString(payload, NS_ATTRIBUTE_ICON_IMAGE, &icon);
 
-    if (icon)
+    if (icon && strlen(icon))
     {
         NSMediaContents * contents = (NSMediaContents *)OICMalloc(sizeof(NSMediaContents));
         if (contents)