From 519fbf338bf0bb49f547a7658392a87cd2c73cd3 Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Wed, 9 Aug 2017 16:23:48 +0200 Subject: [PATCH] DHCP fuzzer: add comments --- src/openvpn/fuzzer-dhcp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/openvpn/fuzzer-dhcp.c b/src/openvpn/fuzzer-dhcp.c index 1d421ca49..142747d1d 100644 --- a/src/openvpn/fuzzer-dhcp.c +++ b/src/openvpn/fuzzer-dhcp.c @@ -6,21 +6,28 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) { return 1; } + int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { struct gc_arena gc; struct buffer ipbuf; in_addr_t ret; + /* Encapsulate raw input buffer in a struct buffer */ ipbuf = alloc_buf(size); if ( buf_write(&ipbuf, data, size) == false ) { goto cleanup; } + + /* Change internal buffer state to test whether dhcp_extract_router_msg + * depends on a certain state */ fuzzer_alter_buffer(&ipbuf); + ret = dhcp_extract_router_msg(&ipbuf); #ifdef MSAN test_undefined_memory(&ret, sizeof(ret)); #endif + cleanup: free_buf(&ipbuf); -- 2.47.2