Bug 1261 - Packet::CopyData ( *buffer, size) return a bad value sometimes when size == Packet::GetSize ()
Packet::CopyData ( *buffer, size) return a bad value sometimes when size == P...
Status: RESOLVED DUPLICATE of bug 1001
Product: ns-3
Classification: Unclassified
Component: network
ns-3-dev
All All
: P5 normal
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-09 11:37 EDT by Frederic Urbani
Modified: 2011-09-10 02:18 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***