- NULL check was missed before passing string to strcmp()
- Hence, added NULL check
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/652
(cherry-picked from
2f6b188bc90dc306f98414189d30206eef38be4a)
Change-Id: Ia92a7a308dcb73999df84d48e67aad6e4d7be0e0
Signed-off-by: samanway-dey <samanway.dey@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
if (g_manufactureDataCount == 0)
{
g_manufactureDataList = u_arraylist_create();
if (g_manufactureDataCount == 0)
{
g_manufactureDataList = u_arraylist_create();
- OIC_LOG(DEBUG, TAG, "List of manufacture data created");
+ if (!g_manufactureDataList)
+ {
+ OIC_LOG(ERROR, TAG, "List could not be created");
+ return;
+ }
+ OIC_LOG(DEBUG, TAG, "List of manufacture data created");
}
for (int i = 0; i < g_manufactureDataCount; i++)
{
char *str = u_arraylist_get(g_manufactureDataList, i);
}
for (int i = 0; i < g_manufactureDataCount; i++)
{
char *str = u_arraylist_get(g_manufactureDataList, i);
- if (!strcmp(uuid, str))
+ if (str && !strcmp(uuid, str))
{
OIC_LOG(DEBUG, TAG, "UUID already set before");
return;
{
OIC_LOG(DEBUG, TAG, "UUID already set before");
return;
if (g_serviceUuidCount == 0)
{
g_serviceUuidList = u_arraylist_create();
if (g_serviceUuidCount == 0)
{
g_serviceUuidList = u_arraylist_create();
+ if (!g_serviceUuidList)
+ {
+ OIC_LOG(ERROR, TAG, "List could not be created");
+ return;
+ }
+
OIC_LOG(DEBUG, TAG, "List of service uuid created");
}
for (int i = 0; i < g_serviceUuidCount; i++)
{
char *str = u_arraylist_get(g_serviceUuidList, i);
OIC_LOG(DEBUG, TAG, "List of service uuid created");
}
for (int i = 0; i < g_serviceUuidCount; i++)
{
char *str = u_arraylist_get(g_serviceUuidList, i);
- if (!strcmp(uuid, str))
+ if (str && !strcmp(uuid, str))
{
OIC_LOG(DEBUG, TAG, "UUID already set before");
return;
{
OIC_LOG(DEBUG, TAG, "UUID already set before");
return;