Add gPstat null check 17/211017/2
authorAleksey Volkov <a.volkov@samsung.com>
Fri, 12 Jul 2019 11:14:35 +0000 (14:14 +0300)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 1 Aug 2019 23:09:46 +0000 (08:09 +0900)
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/541/commits/d070ff1e409154409db8bcb7528c0cb9fc7ed636
(cherry-picked from d070ff1e409154409db8bcb7528c0cb9fc7ed636)

Change-Id: I1c0a5295ebc2962132933335cfb33b578b3cad55
Signed-off-by: Aleksey Volkov <a.volkov@samsung.com>
Signed-off-by: Sudipto Bal <sudipto.bal@samsung.com>
resource/csdk/security/src/pstatresource.c

index 1e8d544..f9834d1 100644 (file)
@@ -291,6 +291,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
     }
     else
     {
+        VERIFY_NON_NULL(TAG, gPstat, ERROR);
         pstat->isOp = gPstat->isOp;
         cborFindResult = CborNoError;
     }
@@ -308,6 +309,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
     }
     else
     {
+        VERIFY_NON_NULL(TAG, gPstat, ERROR);
         memcpy(&pstat->deviceID, &gPstat->deviceID, sizeof(OicUuid_t));
         cborFindResult = CborNoError;
     }
@@ -323,6 +325,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
     }
     else
     {
+        VERIFY_NON_NULL(TAG, gPstat, ERROR);
         pstat->cm = gPstat->cm;
         cborFindResult = CborNoError;
     }
@@ -338,6 +341,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
     }
     else
     {
+        VERIFY_NON_NULL(TAG, gPstat, ERROR);
         pstat->tm = gPstat->tm;
         cborFindResult = CborNoError;
     }
@@ -353,6 +357,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
     }
     else
     {
+        VERIFY_NON_NULL(TAG, gPstat, ERROR);
         pstat->om = gPstat->om;
         cborFindResult = CborNoError;
     }