Fix bug in checkTADomain function 67/159667/6
authorinho1220.kim <inho1220.kim@samsung.com>
Wed, 26 Jul 2017 07:34:00 +0000 (16:34 +0900)
committerKrzysztof Dynowski <k.dynowski@samsung.com>
Tue, 27 Feb 2018 13:29:23 +0000 (14:29 +0100)
 - TC TEE_core/4 is failed. (OpenSession with Invalid UUID)
 need to check NULL.

Change-Id: I61f2996ec3443703afdafdeeb712ea8dc20fa35f

simulatordaemon/src/TEEContext.cpp

index 0bcd678..0cbdaed 100644 (file)
@@ -381,6 +381,7 @@ TEEC_Result TEEContext::openTASession(IntTAOpenSessionData data) {
        memcpy(&sdata.uuid, &data.destination, sizeof(TEEC_UUID));
 
        result = checkTADomain(data);
+
        if (TEEC_SUCCESS != result) {
                data.returnValue = result;
 
@@ -559,7 +560,7 @@ TEEC_Result TEEContext::releaseSharedMemory(RelSharedMemData data) {
 }
 
 TEEC_Result TEEContext::checkTADomain(IntTAOpenSessionData data) {
-       TEEC_Result result = TEEC_ERROR_GENERIC;
+       TEEC_Result result = TEEC_ERROR_ACCESS_DENIED;
 
        LOGD(SIM_DAEMON, "Entry");
 
@@ -589,6 +590,11 @@ TEEC_Result TEEContext::checkTADomain(IntTAOpenSessionData data) {
        dstTAManifest = TABin->getManifest(dest_uuid);
        srcTAManifest = TABin->getManifest(source_uuid);
 
+       if(srcTAManifest == NULL || dstTAManifest == NULL) {
+               LOGE(SIM_DAEMON, "Can`t find TA Manifest - source_uuid(%s), destination_uuid(%s)", source_uuid.c_str(), dest_uuid.c_str());
+               return TEEC_ERROR_ACCESS_DENIED;
+       }
+
        srcCreateDomain = srcTAManifest->policy.protectionDomain.createDomain;
        dstAllowedDomainCount = dstTAManifest->policy.protectionDomain.allowedDomain.size();