Resolve svace defect related to provisioningclient.c and pbkdf2.c 99/14099/2
authorjs126.lee <js126.lee@samsung.com>
Fri, 4 Nov 2016 07:05:04 +0000 (16:05 +0900)
committerRandeep Singh <randeep.s@samsung.com>
Tue, 8 Nov 2016 06:01:19 +0000 (06:01 +0000)
Patch 1 : fix defect on provisioningclient.c
Patch 2,3 : fix defect on pbkdf2.c
Patch 4 : Retrigger Jenkins

Change-Id: I8fb6993639efca6fa8f7bfd861a46fe26b3d6269
Signed-off-by: js126.lee <js126.lee@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14023
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: dongik Lee <dongik.lee@samsung.com>
Reviewed-by: Chul Lee <chuls.lee@samsung.com>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
(cherry picked from commit 60aa05472ff9e2188a391cea043c3392c2f705d2)
Reviewed-on: https://gerrit.iotivity.org/gerrit/14099

resource/csdk/security/provisioning/sample/provisioningclient.c
resource/csdk/security/src/pbkdf2.c

index 3ac3463..45dc3f5 100644 (file)
@@ -1722,9 +1722,22 @@ static OicSecAcl_t* createSimpleAcl(const OicUuid_t uuid)
     size_t arrLen = 1;
     rsrc->typeLen = arrLen;
     rsrc->types = (char**)OICCalloc(arrLen, sizeof(char*));
+    if(!rsrc->types)
+    {
+        OIC_LOG(DEBUG, TAG,  "OICCalloc error return");
+        OCDeleteACLList(acl);
+        return NULL;
+    }
+    rsrc->types[0] = OICStrdup("");   // ignore
+
     rsrc->interfaceLen = 1;
     rsrc->interfaces = (char**)OICCalloc(arrLen, sizeof(char*));
-    rsrc->types[0] = OICStrdup("");   // ignore
+    if(!rsrc->interfaces)
+    {
+        OIC_LOG(DEBUG, TAG,  "OICCalloc error return");
+        OCDeleteACLList(acl);
+        return NULL;
+    }
     rsrc->interfaces[0] = OICStrdup("oic.if.baseline");  // ignore
 
     LL_APPEND(ace->resources, rsrc);
index 785234a..b98c51b 100644 (file)
@@ -75,8 +75,8 @@ int DeriveCryptoKeyFromPassword(const unsigned char *passwd, size_t pLen,
                                 const size_t keyLen, uint8_t *derivedKey)
 {
     int res = 0;
-    uint8_t buf[DTLS_HMAC_DIGEST_SIZE];
-    uint8_t uBuf[DTLS_HMAC_DIGEST_SIZE];
+    uint8_t buf[DTLS_HMAC_DIGEST_SIZE] = {0,};
+    uint8_t uBuf[DTLS_HMAC_DIGEST_SIZE] = {0,};
 
     size_t nBlocks = 0;
     size_t nOctetInLastBlock = 0;