author | mickeyl <mickeyl> | 2003-04-16 13:19:32 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-16 13:19:32 (UTC) |
commit | 05b76911ab2082436c577c1461f0d1210ce0aa33 (patch) (unidiff) | |
tree | d8219eb138ca46f355651152d471664037be372b /libopie2/opienet | |
parent | 5b9d1ddde859ff783f95babf1887fa40e6bfe0be (diff) | |
download | opie-05b76911ab2082436c577c1461f0d1210ce0aa33.zip opie-05b76911ab2082436c577c1461f0d1210ce0aa33.tar.gz opie-05b76911ab2082436c577c1461f0d1210ce0aa33.tar.bz2 |
add sanity check for last packet when capturing from capture file
-rw-r--r-- | libopie2/opienet/opcap.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index 04b1bb1..e362883 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp | |||
@@ -827,9 +827,9 @@ OPacket* OPacketCapturer::next() | |||
827 | qDebug( "<== OPacketCapturer::next()" ); | 827 | qDebug( "<== OPacketCapturer::next()" ); |
828 | if ( _pcd ) | 828 | if ( _pcd ) |
829 | pcap_dump( (u_char*) _pcd, &header, pdata ); | 829 | pcap_dump( (u_char*) _pcd, &header, pdata ); |
830 | 830 | ||
831 | if ( header.len ) | 831 | if ( pdata && header.len ) |
832 | { | 832 | { |
833 | OPacket* p = new OPacket( dataLink(), header, pdata, 0 ); | 833 | OPacket* p = new OPacket( dataLink(), header, pdata, 0 ); |
834 | // packets shouldn't be inserted in the QObject child-parent hierarchy, | 834 | // packets shouldn't be inserted in the QObject child-parent hierarchy, |
835 | // because due to memory constraints they will be deleted as soon | 835 | // because due to memory constraints they will be deleted as soon |
@@ -841,8 +841,9 @@ OPacket* OPacketCapturer::next() | |||
841 | return p; | 841 | return p; |
842 | } | 842 | } |
843 | else | 843 | else |
844 | { | 844 | { |
845 | qWarning( "OPacketCapturer::next() - no packet received!" ); | ||
845 | return 0; | 846 | return 0; |
846 | } | 847 | } |
847 | } | 848 | } |
848 | 849 | ||