From 3d88bd96ca679c974349145d07a3181e6c159daf Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 2 Sep 2019 16:59:38 +0200 Subject: [PATCH] afl/fuzz: fix compiler warnings --- src/decode-afl.c | 10 ++++++++++ src/decode.h | 4 ++++ src/suricata.c | 8 ++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/decode-afl.c b/src/decode-afl.c index 99551ef4e7..54c449874e 100644 --- a/src/decode-afl.c +++ b/src/decode-afl.c @@ -38,6 +38,16 @@ #include "flow.h" #ifdef AFLFUZZ_DECODER +int AFLDecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, + uint8_t *pkt, uint32_t len, PacketQueue *pq) +{ + return DecodeIPV4(tv, dtv, p, pkt, (uint16_t)len, pq); +} +int AFLDecodeIPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, + uint8_t *pkt, uint32_t len, PacketQueue *pq) +{ + return DecodeIPV6(tv, dtv, p, pkt, (uint16_t)len, pq); +} /* stateful processing of data as packets. Because AFL in case of a * crash will only safe the last input, we dump all the inputs to a diff --git a/src/decode.h b/src/decode.h index e24a697d4d..5ed16a3df9 100644 --- a/src/decode.h +++ b/src/decode.h @@ -971,6 +971,10 @@ void AddressDebugPrint(Address *); typedef int (*DecoderFunc)(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint32_t len, PacketQueue *pq); +int AFLDecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, + uint8_t *pkt, uint32_t len, PacketQueue *pq); +int AFLDecodeIPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, + uint8_t *pkt, uint32_t len, PacketQueue *pq); int DecoderParseDataFromFile(char *filename, DecoderFunc Decoder); int DecoderParseDataFromFileSerie(char *fileprefix, DecoderFunc Decoder); #endif diff --git a/src/suricata.c b/src/suricata.c index a0538d6307..1b81f1645c 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -1383,18 +1383,18 @@ static void ParseCommandLineAFL(const char *opt_name, char *opt_arg) SpmTableSetup(); AppLayerProtoDetectSetup(); if (strcmp(opt_name, "afl-decoder-ipv4") == 0) - exit(DecoderParseDataFromFile(opt_arg, DecodeIPV4)); + exit(DecoderParseDataFromFile(opt_arg, AFLDecodeIPV4)); else - exit(DecoderParseDataFromFileSerie(opt_arg, DecodeIPV4)); + exit(DecoderParseDataFromFileSerie(opt_arg, AFLDecodeIPV4)); } else if(strstr(opt_name, "afl-decoder-ipv6") != NULL) { StatsInit(); MpmTableSetup(); SpmTableSetup(); AppLayerProtoDetectSetup(); if (strcmp(opt_name, "afl-decoder-ipv6") == 0) - exit(DecoderParseDataFromFile(opt_arg, DecodeIPV6)); + exit(DecoderParseDataFromFile(opt_arg, AFLDecodeIPV6)); else - exit(DecoderParseDataFromFileSerie(opt_arg, DecodeIPV6)); + exit(DecoderParseDataFromFileSerie(opt_arg, AFLDecodeIPV6)); } else if(strstr(opt_name, "afl-decoder-ethernet") != NULL) { StatsInit(); MpmTableSetup(); -- 2.47.2