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>
Wed, 28 Sep 2016 12:09:51 +0000 (12:09 +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>
service/notification/src/consumer/NSConsumerCommunication.c

index 30e2f10..7f9af56 100644 (file)
@@ -406,7 +406,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)