From 2962a98da92f983b750e4dcd554471510384e711 Mon Sep 17 00:00:00 2001 From: Satya Prakash Gupta Date: Thu, 18 Jun 2015 18:11:56 +0530 Subject: [PATCH] Fix NULL pointer deferencing in policyengine. Update ProcessAccessRequest to call IsAccessGranted only when context is not NULL. Change-Id: I63abb58f254a5080ba46b30203f1e43fa6b2e781 Signed-off-by: Satya Prakash Gupta Reviewed-on: https://gerrit.iotivity.org/gerrit/1359 Tested-by: jenkins-iotivity Reviewed-by: Sachin Agrawal --- resource/csdk/security/src/policyengine.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/resource/csdk/security/src/policyengine.c b/resource/csdk/security/src/policyengine.c index 28ece4a..c9f6aa0 100644 --- a/resource/csdk/security/src/policyengine.c +++ b/resource/csdk/security/src/policyengine.c @@ -259,17 +259,24 @@ void ProcessAccessRequest(PEContext_t *context) } } while((NULL != currentAcl) && (false == context->matchingAclFound)); - } - if(IsAccessGranted(context->retVal)) - { - OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ - Leaving ProcessAccessRequest(ACCESS_GRANTED)")); + + if(IsAccessGranted(context->retVal)) + { + OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ + Leaving ProcessAccessRequest(ACCESS_GRANTED)")); + } + else + { + OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ + Leaving ProcessAccessRequest(ACCESS_DENIED)")); + } } else { OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ - Leaving ProcessAccessRequest(ACCESS_DENIED)")); + Leaving ProcessAccessRequest(context is NULL)")); } + } /** -- 2.7.4