summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-16 13:20:06 (UTC)
committer mickeyl <mickeyl>2003-04-16 13:20:06 (UTC)
commitbe5832dc22255be38884e352917f48d5b71ae657 (patch) (side-by-side diff)
treeeedcdeecb13bd873788fa53599a682b730c3286f
parent05b76911ab2082436c577c1461f0d1210ce0aa33 (diff)
downloadopie-be5832dc22255be38884e352917f48d5b71ae657.zip
opie-be5832dc22255be38884e352917f48d5b71ae657.tar.gz
opie-be5832dc22255be38884e352917f48d5b71ae657.tar.bz2
fix segfault after last packet when capturing from capture file
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index b4b6aa3..0105e09 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -322,68 +322,75 @@ void Wellenreiter::startClicked()
}
// open pcap and start sniffing
if ( cardtype != DEVTYPE_FILE )
{
if ( configwindow->writeCaptureFile->isEnabled() )
{
QString dumpname( configwindow->captureFileName->text() );
dumpname.append( '-' );
dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
dumpname.append( ".wellenreiter" );
pcap->open( interface, dumpname );
}
else
{
pcap->open( interface );
}
}
else
{
pcap->open( QFile( interface ) );
}
if ( !pcap->isOpen() )
{
QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) ));
return;
}
// set capturer to non-blocking mode
pcap->setBlocking( false );
// start channel hopper
if ( cardtype != DEVTYPE_FILE )
iface->setChannelHopping( 1000 ); //use interval from config window
if ( cardtype != DEVTYPE_FILE )
{
// connect socket notifier and start channel hopper
connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
}
else
{
// start timer for reading packets
startTimer( 100 );
}
logwindow->log( "(i) Started Scanning." );
sniffing = true;
emit( startedSniffing() );
if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
else
{
assert( parent() );
( (QMainWindow*) parent() )->setCaption( "Wellenreiter II - replaying capture file..." );
}
}
void Wellenreiter::timerEvent( QTimerEvent* )
{
qDebug( "Wellenreiter::timerEvent()" );
OPacket* p = pcap->next();
- receivePacket( p );
- delete p;
+ if ( !p ) // no more packets available
+ {
+ stopClicked();
+ }
+ else
+ {
+ receivePacket( p );
+ delete p;
+ }
}