bug 2173: WifiInformationElement::DeserializeIfPresent attempts to read beyond the end of buffer
authorAlexander Krotov <ilabdsf@yandex.ru>
Fri, 04 Sep 2015 01:10:29 +0200
changeset 11630 aba589d21bce
parent 11629 b05146a972f2
child 11631 8a9ba9524f57
bug 2173: WifiInformationElement::DeserializeIfPresent attempts to read beyond the end of buffer
src/network/model/buffer.h
src/wifi/model/wifi-information-element.cc
--- a/src/network/model/buffer.h	Thu Sep 03 23:57:43 2015 +0200
+++ b/src/network/model/buffer.h	Fri Sep 04 01:10:29 2015 +0200
@@ -992,7 +992,7 @@
 Buffer::Iterator::PeekU8 (void)
 {
   NS_ASSERT_MSG (m_current >= m_dataStart &&
-                 m_current <= m_dataEnd,
+                 m_current < m_dataEnd,
                  GetReadErrorMessage ());
 
   if (m_current < m_zeroStart)
--- a/src/wifi/model/wifi-information-element.cc	Thu Sep 03 23:57:43 2015 +0200
+++ b/src/wifi/model/wifi-information-element.cc	Fri Sep 04 01:10:29 2015 +0200
@@ -61,6 +61,10 @@
 Buffer::Iterator
 WifiInformationElement::DeserializeIfPresent (Buffer::Iterator i)
 {
+  if (i.IsEnd ())
+    {
+      return i;
+    }
   Buffer::Iterator start = i;
   uint8_t elementId = i.ReadU8 ();