1
0
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:
Matias Fontanini
2011-08-27 18:08:11 -03:00
parent 840b08ef63
commit ec380a5946

View File

@@ -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;