Fixed bug where pointer is dereferenced before it is validated.
authorDoug Hudson <douglas.hudson@intel.com>
Thu, 12 Mar 2015 19:20:49 +0000 (15:20 -0400)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Fri, 13 Mar 2015 16:45:19 +0000 (16:45 +0000)
Change-Id: I6628c52bd3536cf57a320008e46b61968927e3f6
Signed-off-by: Doug Hudson <douglas.hudson@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/468
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
resource/csdk/stack/src/ocstack.c

index c1d0377..3d184d0 100644 (file)
@@ -693,7 +693,7 @@ void HandleCAResponses(const CARemoteEndpoint_t* endPoint, const CAResponseInfo_
         response.result = CAToOCStackResult(responseInfo->result);
         response.resJSONPayload = (unsigned char*)responseInfo->info.payload;
         response.numRcvdVendorSpecificHeaderOptions = 0;
-        if(responseInfo->info.numOptions > 0)
+        if(responseInfo->info.options && responseInfo->info.numOptions > 0)
         {
             int start = 0;
             //First option always with option ID is OC_COAP_OPTION_OBSERVE if it is available.