fuzz-dhcp-server: attach sd_event to make dhcp_server_cleanup_expired_leases() works in the fuzzer

Otherwise, most code paths in dhcp_server_handle_message() are not
evaluated by the fuzzer.
This commit is contained in:
Yu Watanabe
2022-01-25 00:04:59 +09:00
parent 0590f1b58c
commit bf2a8b7b13

View File

@@ -31,6 +31,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
assert_se(duped = memdup(data, size));
assert_se(sd_dhcp_server_new(&server, 1) >= 0);
assert_se(sd_dhcp_server_attach_event(server, NULL, 0) >= 0);
server->fd = open("/dev/null", O_RDWR|O_CLOEXEC|O_NOCTTY);
assert_se(server->fd >= 0);
assert_se(sd_dhcp_server_configure_pool(server, &address, 24, 0, 0) >= 0);