From: Kush Date: Tue, 16 Jul 2019 11:38:45 +0000 (+0530) Subject: Crash in OCCreateResource X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5325e5f3cd9e3f98774c73fbb2342d8734ace7a5;p=platform%2Fupstream%2Fiotivity.git Crash in OCCreateResource Added check for uri before strncmp https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/544/commits/ba1c2fd49c1fd4f519c64943656a5329cf36b0bd (cherry-picked from ba1c2fd49c1fd4f519c64943656a5329cf36b0bd) Change-Id: Ieddc1809174a1360a1bb82a6aeec580cb34e4755 Signed-off-by: Kush Signed-off-by: Sudipto Bal --- diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index caed6d9..086567e 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -3682,7 +3682,7 @@ OCStackResult OCCreateResource(OCResourceHandle *handle, // repeated URLs, which are not allowed. If a repeat is found, exit with an error 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(ERROR, TAG, "Resource %s already exists", uri); return OC_STACK_INVALID_PARAM;