To parse string properly,
need to add null terminator after the last character.
Change-Id: I12541857a1018fe0cc2892c4e271de0723aca23c
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
}
else
{
- setting_location(ijcmd->data);
+ unsigned short length = ijcmd->msg.length;
+ char *data = (char *)malloc(length + 1);
+ if (!data) {
+ LOGERR("failed to malloc\n");
+ return false;
+ }
+ memcpy(data, ijcmd->data, length);
+ data[length] = '\0';
+
+ setting_location(data);
+
+ free(data);
}
return true;
}