[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/cc1000 CC1000SendReceiveP.nc, 1.2, 1.3

David Gay idgay at users.sourceforge.net
Mon Aug 7 14:52:55 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv4010

Modified Files:
	CC1000SendReceiveP.nc 
Log Message:
fix broken bogus-length check revealed by Deputy


Index: CC1000SendReceiveP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000/CC1000SendReceiveP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CC1000SendReceiveP.nc	12 Jul 2006 17:01:33 -0000	1.2
--- CC1000SendReceiveP.nc	7 Aug 2006 21:52:53 -0000	1.3
***************
*** 485,496 ****
      uint8_t nextByte;
      cc1000_header_t *rxHeader = getHeader(rxBufPtr);
! 
!     // rxLength is the offset into a message_t at which the packet
!     // data ends: it is NOT equal to the number of bytes received,
!     // as there may be padding in the message_t before the packet.
!     uint8_t rxLength = rxHeader->length + offsetof(message_t, data);
  
      // Reject invalid length packets
!     if (rxLength > TOSH_DATA_LENGTH + offsetof(message_t, data))
        {
  	// The packet's screwed up, so just dump it
--- 485,492 ----
      uint8_t nextByte;
      cc1000_header_t *rxHeader = getHeader(rxBufPtr);
!     uint8_t rxLength = rxHeader->length;
  
      // Reject invalid length packets
!     if (rxLength > TOSH_DATA_LENGTH)
        {
  	// The packet's screwed up, so just dump it
***************
*** 504,507 ****
--- 500,505 ----
      ((uint8_t *)rxBufPtr)[count++] = nextByte;
  
+     // Adjust rxLength to correspond to the corresponding offset in message_t
+     rxLength += offsetof(message_t, data);
      if (count <= rxLength)
        runningCrc = crcByte(runningCrc, nextByte);



More information about the Tinyos-2-commits mailing list