Fixed: bug where Header Option count would be zero
authorErich Keane <erich.keane@intel.com>
Tue, 18 Nov 2014 22:06:12 +0000 (14:06 -0800)
committerErich Keane <erich.keane@intel.com>
Tue, 18 Nov 2014 22:16:44 +0000 (14:16 -0800)
01.org IOT-76

Header options had a defect introduced attempting to fix
the 'zero' header option count value.  In the previous defect,
the stack would have an uninitialized header options count
when there were none.  The previous fix has been removed and
initialization has been done in the correct place.

Change-Id: I99e0539f86573cfa7392921e1fdfe25dd80b303a
Signed-off-by: Erich Keane <erich.keane@intel.com>
resource/csdk/occoap/src/occoaphelper.c

index 3d4e2bc..ceed9dd 100644 (file)
@@ -300,8 +300,9 @@ OCStackResult ParseCoAPPdu(coap_pdu_t * pdu, unsigned char * uriBuf,
             OC_LOG_BUFFER(INFO, TAG, rcvVendorSpecificHeaderOptions[i].optionData,
                     rcvVendorSpecificHeaderOptions[i].optionLength);
             i++;
-            *numRcvVendorSpecificHeaderOptions = i;
         }
+
+        *numRcvVendorSpecificHeaderOptions = i;
     }
 
     // get the payload
@@ -400,7 +401,6 @@ OCStackResult FormOCEntityHandlerRequest(OCEntityHandlerRequest * entityHandlerR
         entityHandlerRequestLoc->obsInfo = NULL;
         entityHandlerRequestLoc->newResourceUri = newResUriBuf;
 
-        entityHandlerRequestLoc->numRcvdVendorSpecificHeaderOptions = 0;
         entityHandlerRequestLoc->numSendVendorSpecificHeaderOptions = 0;
         return OC_STACK_OK;
     }