diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d757675 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/cmake-build-* +/.idea \ No newline at end of file diff --git a/dot11decrypt.cpp b/dot11decrypt.cpp index 9eeba79..42a1a9b 100644 --- a/dot11decrypt.cpp +++ b/dot11decrypt.cpp @@ -58,6 +58,7 @@ using std::move; using std::memset; using std::bind; using std::cout; +using std::cerr; using std::endl; using std::runtime_error; using std::invalid_argument; @@ -194,7 +195,14 @@ class packet_buffer { auto pkt = make_eth_packet(dot11); // move the inner pdu into the EthernetII to avoid copying pkt.inner_pdu(snap.release_inner_pdu()); - auto buffer = pkt.serialize(); + vector buffer; + try { + buffer = pkt.serialize(); + } + catch (Tins::serialization_error) { + cerr << "Serialization error!" << endl; + return false; + } if (write(*fd_, buffer.data(), buffer.size()) == -1) { throw runtime_error("Error writing to tap interface"); }