From 5d8ef488dc716f03b75f815ded1c0c18062f7188 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 3 Mar 2020 00:03:50 -0500 Subject: [PATCH] bgpd: reset fuzzer stream Not resetting this results in random cov Signed-off-by: Quentin Young --- bgpd/bgp_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 96d7006a26..f0b3a4c45a 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -509,8 +509,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) p = FuzzingPeer; #endif /* FUZZING_LIBFUZZER */ + ringbuf_reset(p->ibuf_work); ringbuf_put(p->ibuf_work, data, size); + int result = 0; + unsigned char pktbuf[BGP_MAX_PACKET_SIZE]; + uint16_t pktsize = 0; + /* * Simulate the read process done by bgp_process_reads(). * @@ -527,10 +532,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) fprintf(stderr, "good header\n"); - int result = 0; - unsigned char pktbuf[BGP_MAX_PACKET_SIZE]; - uint16_t pktsize = 0; - ringbuf_peek(p->ibuf_work, BGP_MARKER_SIZE, &pktsize, sizeof(pktsize)); pktsize = ntohs(pktsize); -- 2.39.5