[ns] packet->copy() method

Carmelo Ragusa c.ragusa at eim.surrey.ac.uk
Mon May 17 02:21:24 PDT 2004


Dear all,
I'm having a problem with the packet->copy() method. Apparently it seems
that it doesn't copy the data. Looking at the code in packet.h seems that
it should do it:

memcpy(data_, d.data_, datalen_);

the problem is that I get a segmentation fault. I checked it also with
valgrind, doing just a packet copy and reading from the copy and I get:

==29143==
==29143== Use of uninitialised value of size 4
==29143==    at 0x4002110B: strlen (mac_replace_strmem.c:164)
==29143==    by 0x42051F4C: _IO_vfprintf_internal (in
/lib/i686/libc-2.2.5.so)
==29143==    by 0x4206DCF2: _IO_vsprintf_internal (in
/lib/i686/libc-2.2.5.so)
==29143==    by 0x4205A356: _IO_sprintf (in /lib/i686/libc-2.2.5.so)
==29143==
==29143== Invalid read of size 1
==29143==    at 0x4002110B: strlen (mac_replace_strmem.c:164)
==29143==    by 0x42051F4C: _IO_vfprintf_internal (in
/lib/i686/libc-2.2.5.so)
==29143==    by 0x4206DCF2: _IO_vsprintf_internal (in
/lib/i686/libc-2.2.5.so)
==29143==    by 0x4205A356: _IO_sprintf (in /lib/i686/libc-2.2.5.so)
==29143==    Address 0x56442F7F is not stack'd, malloc'd or free'd
Segmentation fault


Is there anybody that knows why this is happening? Can somebody gives some
suggestion?
Any advice would be appreciated.

Many thanks in advance,
Carmelo



More information about the Ns-users mailing list