-rw-r--r-- | libopie2/opienet/opcap.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index f8ebe6b..a9dc577 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp @@ -53,19 +53,19 @@ namespace Net { /*====================================================================================== * OPacket *======================================================================================*/ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) :QObject( parent, "Generic" ), _hdr( header ), _data( 0 ) { - _data = new unsigned char[sizeof data]; + _data = new unsigned char[ header.len ]; assert( _data ); - memcpy( const_cast<unsigned char*>(_data), data, sizeof data ); + memcpy( const_cast<unsigned char*>(_data), data, header.len ); // We have to copy the data structure here, because the 'data' pointer handed by libpcap // points to an internal region which is reused by lipcap. odebug << "OPacket: Length = " << header.len << ", Caplen = " << header.caplen << oendl; _end = (unsigned char*) _data + header.len; switch ( datalink ) { case DLT_EN10MB: |