mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Fixed bug in Sniffer::next_packet.
This commit is contained in:
@@ -72,14 +72,16 @@ Tins::PDU *Tins::Sniffer::next_packet(const string &filter) {
|
||||
PDU *ret = 0;
|
||||
while(!ret) {
|
||||
const u_char *content = pcap_next(handle, &header);
|
||||
try {
|
||||
if(wired)
|
||||
ret = new EthernetII((const uint8_t*)content, header.caplen);
|
||||
else
|
||||
ret = new RadioTap((const uint8_t*)content, header.caplen);
|
||||
}
|
||||
catch(...) {
|
||||
ret = 0;
|
||||
if(content) {
|
||||
try {
|
||||
if(wired)
|
||||
ret = new EthernetII((const uint8_t*)content, header.caplen);
|
||||
else
|
||||
ret = new RadioTap((const uint8_t*)content, header.caplen);
|
||||
}
|
||||
catch(...) {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user