Skip to content

Commit

Permalink
Fuzz only raw packets for .snoop
Browse files Browse the repository at this point in the history
  • Loading branch information
sashashura committed Nov 7, 2023
1 parent 4531107 commit ee61e76
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions Tests/Fuzzers/FuzzTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,22 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
pcpp::RawPacket& rawPacket = *packets.front();
do
{
pcpp::Packet parsedPacket(&rawPacket);
parsedPacket.toString();
auto layer = parsedPacket.getFirstLayer();
while (layer != NULL)
// go deeper only for .pcap and .pcapng format
// for .snoop we are only fuzzing the reader
if (0 == strcmp(FILE_EXT, ".pcap") || 0 == strcmp(FILE_EXT, ".pcapng"))
{
std::cout << layer->toString() << std::endl;
layer->getHeaderLen();
readParsedPacket(parsedPacket, layer);
layer = layer->getNextLayer();
pcpp::Packet parsedPacket(&rawPacket);
parsedPacket.toString();
auto layer = parsedPacket.getFirstLayer();
while (layer != NULL)
{
std::cout << layer->toString() << std::endl;
layer->getHeaderLen();
readParsedPacket(parsedPacket, layer);
layer = layer->getNextLayer();
}
parsedPacket.computeCalculateFields();
}
parsedPacket.computeCalculateFields();

} while (reader->getNextPacket(rawPacket));

reader->close();
Expand Down

0 comments on commit ee61e76

Please sign in to comment.