Bug 1261

Summary: Packet::CopyData ( *buffer, size) return a bad value sometimes when size == Packet::GetSize ()
Product: ns-3 Reporter: Frederic Urbani <frederic.urbani>
Component: networkAssignee: ns-bugs <ns-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: mathieu.lacage
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   

Description Frederic Urbani 2011-09-09 11:37:37 EDT
In my test case I have a packet P filled with valid data (not zero filled)  AND :

P->GetSize () return 14
then
P->CopyData (buf, 14) return 0 ?

So my patch is here :


diff -r e52db23c9c8b src/network/model/buffer.cc
--- a/src/network/model/buffer.cc	Thu Sep 08 18:24:47 2011 -0700
+++ b/src/network/model/buffer.cc	Fri Sep 09 17:34:22 2011 +0200
@@ -777,6 +777,10 @@
               memcpy (buffer, (const char*)(m_data->m_data + m_zeroAreaStart), tmpsize);
             }
         }
+      else
+        {
+          return tmpsize;
+        }
     }
   return originalSize - size;
 }
Comment 1 Mathieu Lacage 2011-09-10 02:18:31 EDT
This is a duplicate of bug 1001. It would be helpful if you could provide a testcase, so we can test the original patch

*** This bug has been marked as a duplicate of bug 1001 ***