diff -r 7e5c1a14eff3 src/common/packet.cc --- a/src/common/packet.cc Wed Sep 15 20:43:31 2010 -0700 +++ b/src/common/packet.cc Thu Sep 16 14:14:07 2010 +1000 @@ -731,12 +731,13 @@ // read nix-vector NS_ASSERT (!m_nixVector); uint32_t nixSize = *p++; + + // if size less than nixSize, the buffer + // will be overrun, assert + NS_ASSERT (size >= nixSize); + size -= nixSize; - // if size less than zero, the buffer - // will be overrun, assert - NS_ASSERT (size >= 0); - if (nixSize > 4) { Ptr nix = Create (); @@ -760,12 +761,13 @@ // read metadata uint32_t metaSize = *p++; + + // if size less than metaSize, the buffer + // will be overrun, assert + NS_ASSERT (size >= metaSize); + size -= metaSize; - // if size less than zero, the buffer - // will be overrun, assert - NS_ASSERT (size >= 0); - uint32_t metadataDeserialized = m_metadata.Deserialize (reinterpret_cast (p), metaSize); if (!metadataDeserialized) @@ -780,12 +782,13 @@ // read buffer contents uint32_t bufSize = *p++; + + // if size less than bufSize, the buffer + // will be overrun, assert + NS_ASSERT (size >= bufSize); + size -= bufSize; - // if size less than zero, the buffer - // will be overrun, assert - NS_ASSERT (size >= 0); - uint32_t bufferDeserialized = m_buffer.Deserialize (reinterpret_cast (p), bufSize); if (!bufferDeserialized)