]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
afl/fuzz: fix compiler warnings 4157/head
authorVictor Julien <victor@inliniac.net>
Mon, 2 Sep 2019 14:59:38 +0000 (16:59 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 2 Sep 2019 14:59:38 +0000 (16:59 +0200)
src/decode-afl.c
src/decode.h
src/suricata.c

index 99551ef4e75656dce2b26c735a2b1dc6cd591a70..54c449874efad5fde14a407b4b5334e83e40132b 100644 (file)
 #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
index e24a697d4dfad12cc859a9de5dbaf6b9d3e301e6..5ed16a3df9503cd82859fba5a4cd0ca3f894f50b 100644 (file)
@@ -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
index a0538d63076d38d79c01b38304d3439045cf8279..1b81f1645c1c85368b2e335c401e81fa83576cbd 100644 (file)
@@ -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();