From dc62fabc0bcaab35a32f105cb489350b516ff8eb Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 5 Jun 2007 14:06:58 +0200 Subject: [PATCH] fix addition of a trailer or a header --- src/common/packet-history.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/packet-history.cc b/src/common/packet-history.cc index 02efc2e8f..f3a3770d0 100644 --- a/src/common/packet-history.cc +++ b/src/common/packet-history.cc @@ -396,8 +396,8 @@ void PacketHistory::ReserveCopy (uint32_t size) { struct PacketHistory::Data *newData = PacketHistory::Create (m_used + size); - memcpy (newData->m_data, m_data->m_data, m_end); - newData->m_dirtyEnd = m_end; + memcpy (newData->m_data, m_data->m_data, m_used); + newData->m_dirtyEnd = m_used; m_data->m_count--; if (m_data->m_count == 0) { @@ -565,6 +565,7 @@ PacketHistory::AddSmall (bool atStart, if (m_data == 0) { m_data = PacketHistory::Create (10); + memset (m_data->m_data, 0, 4); } NS_ASSERT (m_data != 0); uint16_t chunkUid = m_chunkUid; @@ -616,7 +617,7 @@ PacketHistory::AddSmall (bool atStart, n += GetUleb128Size (chunkUid); n += GetUleb128Size (size); n += 2 + 2; - Reserve (n); + ReserveCopy (n); goto append; }