pointer check before dereferensing 09/29309/4
authorOleksandr Dmytrenko <o.dmytrenko@samsung.com>
Thu, 28 Feb 2019 13:43:33 +0000 (15:43 +0200)
committerAleksey Volkov <a.volkov@samsung.com>
Mon, 11 Mar 2019 09:23:50 +0000 (09:23 +0000)
targetId check in PMDeleteFromUUIDList before derefensing

Change-Id: I1b1dae4091c5058d018c5cb472d6db2503fecb40
Signed-off-by: Oleksandr Dmytrenko <o.dmytrenko@samsung.com>
resource/csdk/security/provisioning/src/pmutility.c

index 3aec5e5..3219b06 100644 (file)
@@ -1467,7 +1467,7 @@ static OCStackApplicationResult MOTDeviceDiscoveryHandler(void *ctx, OCDoHandle
  * @param[in]  timeoutSeconds  Maximum time, in seconds, this function will listen for responses from
  *                             servers before returning.
  * @param[in]  deviceID        deviceID of target device.
- * @param[out] ppFoundDevice   OCProvisionDev_t of found device. Caller should use PMDeleteDeviceList 
+ * @param[out] ppFoundDevice   OCProvisionDev_t of found device. Caller should use PMDeleteDeviceList
  *                             to delete the device.
  *
  * @return OC_STACK_OK on success otherwise error.
@@ -1640,7 +1640,7 @@ OCStackResult PMMultipleOwnerDeviceDiscovery(unsigned short waittime, bool isMul
  * @return OC_STACK_OK in case of success and other value otherwise.
  */
 OCStackResult PMIsSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner)
-{  
+{
     if ((NULL == device) || (NULL == isSubowner))
     {
         return OC_STACK_INVALID_PARAM;
@@ -1800,7 +1800,7 @@ void PMPrintOCProvisionDev(const OCProvisionDev_t* pDev)
 
 bool PMDeleteFromUUIDList(OCUuidList_t **pUuidList, OicUuid_t *targetId)
 {
-    if(*pUuidList == NULL || targetId == NULL)
+    if(pUuidList == NULL || *pUuidList == NULL || targetId == NULL)
     {
         return false;
     }