diff options
author | Oleksandr Dmytrenko <o.dmytrenko@samsung.com> | 2017-05-19 14:54:35 +0300 |
---|---|---|
committer | Dmitriy Zhuravlev <d.zhuravlev@samsung.com> | 2017-05-20 06:40:18 +0000 |
commit | 50d13253c39512e06c9ea08b12a1ca97465e1164 (patch) | |
tree | 355ad5db984b09e36f6b7877a9e28ddcfc1eef68 /resource/csdk | |
parent | 9b5f6dfbfdaa8ea9f9b0b426c6be7e396a565d82 (diff) | |
download | iotivity-50d13253c39512e06c9ea08b12a1ca97465e1164.tar.gz iotivity-50d13253c39512e06c9ea08b12a1ca97465e1164.tar.bz2 iotivity-50d13253c39512e06c9ea08b12a1ca97465e1164.zip |
[IOT-2317] gDoxm NULL checks
Accessing global pointer variable gDoxm without NULL check fix
Change-Id: Ief964e6c941ef17a7a24fc07fb4f1807cfc07e0f
Signed-off-by: Oleksandr Dmytrenko <o.dmytrenko@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20139
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: dongik Lee <dongik.lee@samsung.com>
Reviewed-by: Dmitriy Zhuravlev <d.zhuravlev@samsung.com>
Diffstat (limited to 'resource/csdk')
-rw-r--r-- | resource/csdk/security/src/doxmresource.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/resource/csdk/security/src/doxmresource.c b/resource/csdk/security/src/doxmresource.c index b2a24454c..a68985150 100644 --- a/resource/csdk/security/src/doxmresource.c +++ b/resource/csdk/security/src/doxmresource.c @@ -1091,6 +1091,12 @@ void MultipleOwnerDTLSHandshakeCB(const CAEndpoint_t *object, CAResult_t caRes = CAGetSecureEndpointData(object, &authenticationSubOwnerInfo); if (CA_STATUS_OK == caRes) { + if (!gDoxm) + { + OIC_LOG_V(WARNING, TAG, "%s: gDoxm is NULL", __func__); + return; + } + if (0 == memcmp(authenticationSubOwnerInfo.identity.id, gDoxm->owner.id, authenticationSubOwnerInfo.identity.id_length)) { @@ -1260,6 +1266,8 @@ static OCEntityHandlerResult HandleDoxmPostRequest(OCEntityHandlerRequest * ehRe goto exit; } + VERIFY_NOT_NULL(TAG, gDoxm, ERROR); + // in owned state if (true == gDoxm->owned) { @@ -1784,9 +1792,13 @@ OCStackResult CreateDoxmResource() */ static OCStackResult CheckDeviceID() { + OIC_LOG_V(DEBUG, TAG, "IN: %s", __func__); + OCStackResult ret = OC_STACK_ERROR; bool validId = false; + VERIFY_NOT_NULL_RETURN(TAG, gDoxm, ERROR, OC_STACK_INVALID_PARAM); + for (uint8_t i = 0; i < UUID_LENGTH; i++) { if (gDoxm->deviceID.id[i] != 0) @@ -1869,6 +1881,8 @@ static OCStackResult CheckDeviceID() ret = OC_STACK_OK; } + OIC_LOG_V(DEBUG, TAG, "OUT: %s", __func__); + return ret; } @@ -2227,6 +2241,8 @@ OCStackResult SetMOTStatus(bool enable) OIC_LOG_V(DEBUG, TAG, "In %s", __func__); + VERIFY_NOT_NULL(TAG, gDoxm, ERROR); + if (NULL == gDoxm->mom && !enable) { OIC_LOG_V(DEBUG, TAG, "Out %s", __func__); |