SVACE issue fix 89/128989/2 accepted/tizen/unified/20170512.170034 submit/tizen/20170512.083921
authorManasij Sur Roy <manasij.r@samsung.com>
Fri, 12 May 2017 08:12:36 +0000 (13:42 +0530)
committerManasij Sur Roy <manasij.r@samsung.com>
Fri, 12 May 2017 08:30:57 +0000 (14:00 +0530)
Change-Id: Ie38b89e8eca7acebd6bd84cc59af5362e87b7934
Signed-off-by: Manasij Sur Roy <manasij.r@samsung.com>
12 files changed:
common/uafv1tlvutil/src/AttBasicFullTlvEncoder.cpp
common/uafv1tlvutil/src/AttBasicSurrTlvEncoder.cpp
common/uafv1tlvutil/src/DeRegReqTlvEncoder.cpp
common/uafv1tlvutil/src/DeRegRespTlvEncoder.cpp
common/uafv1tlvutil/src/GetInfoRespTlvEncoder.cpp
common/uafv1tlvutil/src/RegAuthAssertionTlvEncoder.cpp
common/uafv1tlvutil/src/RegReqTlvEncoder.cpp
common/uafv1tlvutil/src/RegRespTlvEncoder.cpp
common/uafv1tlvutil/src/SignAuthAssertionTlvEncoder.cpp
common/uafv1tlvutil/src/SignReqTlvEncoder.cpp
common/uafv1tlvutil/src/Uafv1KrdTlvEncoder.cpp
common/uiutil/src/PinAuthUiAdaptor.cpp

index b93cc5e..233d16b 100644 (file)
@@ -63,7 +63,11 @@ AttBasicFullTlvEncoder::decode(const unsigned char *rawData)
 
        tlv_s *root = tlv_decode(rawData);
        RET_IF_FAIL(root != NULL, NULL);
-       RET_IF_FAIL(root->tag == TAG_ATTESTATION_BASIC_FULL, NULL);
+       if (root->tag != TAG_ATTESTATION_BASIC_FULL) {
+               SAFE_DELETE(root->val);
+               SAFE_DELETE(root);
+               return NULL;
+       }
 
        int rawIter = 2 + 2;
        int endIter = rawIter + root->len;
index 540223c..7b37eaf 100644 (file)
@@ -60,7 +60,11 @@ AttBasicSurrTlvEncoder::decode(const unsigned char *rawData)
 
        tlv_s *root = tlv_decode(rawData);
        RET_IF_FAIL(root != NULL, NULL);
-       RET_IF_FAIL(root->tag == TAG_ATTESTATION_BASIC_SURROGATE, NULL);
+       if (root->tag != TAG_ATTESTATION_BASIC_SURROGATE) {
+               SAFE_DELETE(root->val);
+               SAFE_DELETE(root);
+               return NULL;
+       }
 
        int rawIter = 2 + 2;
        int endIter = rawIter + root->len;
index 830f1d4..d4ff376 100644 (file)
@@ -75,7 +75,11 @@ DeRegReqTlvEncoder::decode(const unsigned char *rawData)
 
        tlv_s *root = tlv_decode(rawData);
        RET_IF_FAIL(root != NULL, NULL);
-       RET_IF_FAIL(root->tag == TAG_UAFV1_DEREGISTER_CMD, NULL);
+       if (root->tag != TAG_UAFV1_DEREGISTER_CMD) {
+               SAFE_DELETE(root->val);
+               SAFE_DELETE(root);
+               return NULL;
+       }
 
        int rawIter = 2 + 2;
        int endIter = rawIter + root->len;
index 1302893..e6a8ac5 100644 (file)
@@ -59,7 +59,11 @@ DeRegRespTlvEncoder::decode(const unsigned char *rawData)
 
        tlv_s *root = tlv_decode(rawData);
        RET_IF_FAIL(root != NULL, NULL);
-       RET_IF_FAIL(root->tag == TAG_UAFV1_DEREGISTER_CMD_RESPONSE, NULL);
+       if (root->tag != TAG_UAFV1_DEREGISTER_CMD_RESPONSE) {
+               SAFE_DELETE(root->val);
+               SAFE_DELETE(root);
+               return NULL;
+       }
 
        DeregResp *getDeRegRespInfo = ALLOC(DeregResp);
 
index 7485cd6..132a586 100644 (file)
@@ -459,6 +459,9 @@ AuthInfoTlvEncoder::decode(const unsigned char *rawData)
                if (rawIter >= end_iter)
                        break;
 
+               SAFE_DELETE(child->val);
+               SAFE_DELETE(child);
+
                child = tlv_decode(rawData + rawIter);
        }
 
@@ -637,8 +640,8 @@ GetInfoRespTlvEncoder::decode(const unsigned char *rawData)
        int end_iter = rawIter + root->len;
        _INFO("GetInfoRespTlvEncoder TOTAL LEN = [%d] bytes", end_iter);
 
-       RET_IF_FAIL(root->tag == TAG_UAFV1_GETINFO_CMD_RESPONSE, NULL);
        if (root->tag != TAG_UAFV1_GETINFO_CMD_RESPONSE) {
+               SAFE_DELETE(root->val);
                SAFE_DELETE(root);
                return NULL;
        }
index a848d6d..49e1aa8 100644 (file)
@@ -52,6 +52,7 @@ RegAuthAssertionTlvEncoder::encode(const void *authData)
                regAssertionKrdBuff->data = getRegAssertionKrdTlv->val;
                tlv_builder_add_buffer(builder, TAG_UAFV1_KRD, regAssertionKrdBuff);
                SAFE_DELETE(regAssertionKrdBuff);
+               SAFE_DELETE(getRegAssertionKrdTlv);
        }
 
        if(getRegAssertion->attFull != NULL) {
@@ -68,6 +69,7 @@ RegAuthAssertionTlvEncoder::encode(const void *authData)
                tlv_builder_add_buffer(builder, TAG_ATTESTATION_BASIC_FULL, attBasicFullBuff);
                SAFE_DELETE(attBasicFullBuff);
                SAFE_DELETE(getAttBasicFullBuffInfo);
+               SAFE_DELETE(getAttBasicFullInfoTlv);
        }
        else if(getRegAssertion->attSur != NULL) {
 
@@ -83,6 +85,7 @@ RegAuthAssertionTlvEncoder::encode(const void *authData)
                tlv_builder_add_buffer(builder, TAG_ATTESTATION_BASIC_SURROGATE, attBasicSurrBuff);
                SAFE_DELETE(attBasicSurrBuff);
                SAFE_DELETE(getAttBasicSurrInfoBuff);
+               SAFE_DELETE(getAttBasicSurrInfoTlv);
        }
        else {
 
@@ -110,6 +113,7 @@ RegAuthAssertionTlvEncoder::decode(const unsigned char *rawData)
        tlv_s *root = tlv_decode(rawData);
        RET_IF_FAIL(root != NULL, NULL);
        if (root->tag != TAG_UAFV1_REG_ASSERTION) {
+               SAFE_DELETE(root->val);
                SAFE_DELETE(root);
                return NULL;
        }
index 0f7b4c2..3226efd 100644 (file)
@@ -88,6 +88,7 @@ RegAssertionTlvEncoder::decode(const unsigned char *rawData)
        tlv_s* root = tlv_decode(rawData);
        RET_IF_FAIL(root != NULL, NULL);
        if (root->tag != TAG_UAFV1_REGISTER_CMD) {
+               SAFE_DELETE(root->val);
                SAFE_DELETE(root);
                return NULL;
        }
index a72c8a4..ef1322e 100644 (file)
@@ -74,6 +74,7 @@ RegRespTlvEncoder::decode(const unsigned char *rawData)
        tlv_s *root = tlv_decode(rawData);
        RET_IF_FAIL(root != NULL, NULL);
        if (root->tag != TAG_UAFV1_REGISTER_CMD_RESPONSE) {
+               SAFE_DELETE(root->val);
                SAFE_DELETE(root);
                return NULL;
        }
index cb08bcf..1032219 100644 (file)
@@ -53,6 +53,7 @@ SignAuthAssertionTlvEncoder::encode(const void *authData)
 
                tlv_builder_add_buffer(builder, TAG_UAFV1_SIGNED_DATA, getSigDataBuff);
                SAFE_DELETE(getSigDataBuff);
+               SAFE_DELETE(getSigDataInfoTlv);
 
                /*1.2 end*/
        }
@@ -78,7 +79,11 @@ SignAuthAssertionTlvEncoder::decode(const unsigned char *rawData)
 
        tlv_s *root = tlv_decode(rawData);
        RET_IF_FAIL(root != NULL, NULL);
-       RET_IF_FAIL(root->tag == TAG_UAFV1_AUTH_ASSERTION, NULL);
+       if (root->tag != TAG_UAFV1_AUTH_ASSERTION) {
+               SAFE_DELETE(root->val);
+               SAFE_DELETE(root);
+               return NULL;
+       }
 
        int rawIter = 2 + 2;
        AuthAssertion *getAuthAssInfo = ALLOC(AuthAssertion);
index 42c6de3..65c82fe 100644 (file)
@@ -100,7 +100,11 @@ SignReqTlvEncoder::decode(const unsigned char *rawData)
 
        tlv_s *root = tlv_decode(rawData);
        RET_IF_FAIL(root != NULL, NULL);
-       RET_IF_FAIL(root->tag == TAG_UAFV1_SIGN_CMD, NULL);
+       if (root->tag != TAG_UAFV1_SIGN_CMD) {
+               SAFE_DELETE(root->val);
+               SAFE_DELETE(root);
+               return NULL;
+       }
 
        int rawIter = 2 + 2;
        int endIter = rawIter + root->len;
index e040fae..d70db73 100644 (file)
@@ -89,7 +89,11 @@ Uafv1KrdTlvEncoder::decode(const unsigned char *rawData)
 
        tlv_s* root = tlv_decode(rawData);
        RET_IF_FAIL(root != NULL, NULL);
-       RET_IF_FAIL(root->tag == TAG_UAFV1_KRD, NULL);
+       if (root->tag != TAG_UAFV1_KRD) {
+               SAFE_DELETE(root->val);
+               SAFE_DELETE(root);
+               return NULL;
+       }
 
        int rawIter = 2 + 2;
        int endIter = rawIter + root->len;
index f8c436c..38f0d62 100644 (file)
@@ -105,7 +105,6 @@ PinAuthUiAdaptor::getTokenFromUi(pin_auth_mode_e type, const std::string& appId,
        for (int i = 0; i < 10; i++) {
                uiPid = aul_launch_app_for_uid(ASM_UI_APP_NAME, b, OWNER_UID);
                _INFO("aul_launch_app = [%d]", uiPid);
-               bundle_free(b);
                if (uiPid < 0) {
                        if (uiPid == AUL_R_EINVAL)
                                _INFO("AUL_R_EINVAL");
@@ -122,6 +121,8 @@ PinAuthUiAdaptor::getTokenFromUi(pin_auth_mode_e type, const std::string& appId,
                }
        }
 
+       bundle_free(b);
+
        if (uiPid < 0) {
                *err = -1;
                return "";