Check for NULL parameter
authorsaurabh.s9 <saurabh.s9@samsung.com>
Tue, 21 Jun 2016 06:49:25 +0000 (12:19 +0530)
committerRandeep Singh <randeep.s@samsung.com>
Thu, 23 Jun 2016 04:51:51 +0000 (04:51 +0000)
Change-Id: I27b316b11f0362deeaff2de8e06ffc296759411d
Signed-off-by: saurabh.s9 <saurabh.s9@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8813
Reviewed-by: Ashwini Kumar <k.ashwini@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
resource/csdk/security/provisioning/src/credentialgenerator.c

index 44e80a4..5062374 100644 (file)
@@ -44,8 +44,8 @@ OCStackResult PMGeneratePairWiseCredentials(OicSecCredType_t type, size_t keySiz
         const OicUuid_t *ptDeviceId, const OicUuid_t *firstDeviceId,
         const OicUuid_t *secondDeviceId, OicSecCred_t **firstCred, OicSecCred_t **secondCred)
 {
-    if (NULL == ptDeviceId || NULL == firstDeviceId || NULL != *firstCred || \
-        NULL == secondDeviceId || NULL != *secondCred)
+    if (NULL == ptDeviceId || NULL == firstDeviceId || NULL == firstCred || NULL != *firstCred || \
+        NULL == secondDeviceId || NULL == secondCred || NULL != *secondCred)
     {
         OIC_LOG(INFO, TAG, "Invalid params");
         return OC_STACK_INVALID_PARAM;
@@ -217,7 +217,7 @@ static OCStackResult GenerateCertificateAndKeys(const OicUuid_t * subject, OicSe
 OCStackResult PMGenerateCertificateCredentials(const OicUuid_t *ptDeviceId,
         const OicUuid_t *deviceId, OicSecCred_t **const cred)
 {
-    if (NULL == ptDeviceId || NULL == deviceId || NULL == cred)
+    if (NULL == ptDeviceId || NULL == deviceId || NULL == cred || NULL != *cred)
     {
         return OC_STACK_INVALID_PARAM;
     }