NULL check was not there before accessing "pointer->uri" due to which segmentation fault has occurred.
So NULL check is done at two different places.
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/629
(cherry-picked from
727d5f58b67d83d3c82452b0afb7781bba59ec81)
Change-Id: I77878da7f89858235feafbc7b25a4e1fef39a52a
Signed-off-by: Senthil Kumar G S <senthil.gs@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
return OC_STACK_OK;
}
+// TODO: headResource needs to be accessed in a thread-safe manner
OCResource *FindResourceByUri(const char* resourceUri)
{
if(!resourceUri)
OCResource * pointer = headResource;
while (pointer)
{
- if (strcmp(resourceUri, pointer->uri) == 0)
+ if (pointer->uri && strcmp(resourceUri, pointer->uri) == 0)
{
return pointer;
}
while (pointer)
{
- if (strncmp(uri, pointer->uri, MAX_URI_LENGTH) == 0)
+ if (pointer->uri && strncmp(uri, pointer->uri, MAX_URI_LENGTH) == 0)
{
OIC_LOG_V(DEBUG, TAG, "Found Resource %s", uri);
return pointer;