summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/fuzz-dhcp-server-relay.c
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2023-10-18 23:11:13 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2023-10-19 11:05:20 +0200
commit4820c9d41748640ce6a29fc76d6463c822a31662 (patch)
tree073c65a8e74eaede325f46b32b9615886e0425ae /src/libsystemd-network/fuzz-dhcp-server-relay.c
parentMerge pull request #29611 from mrc0mmand/execute-serialize-fuzz (diff)
downloadsystemd-4820c9d41748640ce6a29fc76d6463c822a31662.tar.xz
systemd-4820c9d41748640ce6a29fc76d6463c822a31662.zip
fuzz: unify logging setup
Make sure we don't log anything when running in "fuzzing" mode. Also, when at it, unify the setup logic into a helper, pretty similar to the test_setup_logging() one. Addresses: - https://github.com/systemd/systemd/pull/29558#pullrequestreview-1676060607 - https://github.com/systemd/systemd/pull/29558#discussion_r1358940663
Diffstat (limited to 'src/libsystemd-network/fuzz-dhcp-server-relay.c')
-rw-r--r--src/libsystemd-network/fuzz-dhcp-server-relay.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libsystemd-network/fuzz-dhcp-server-relay.c b/src/libsystemd-network/fuzz-dhcp-server-relay.c
index a53e1c2537..3241d7c8da 100644
--- a/src/libsystemd-network/fuzz-dhcp-server-relay.c
+++ b/src/libsystemd-network/fuzz-dhcp-server-relay.c
@@ -25,6 +25,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (size < sizeof(DHCPMessage))
return 0;
+ fuzz_setup_logging();
+
assert_se(sd_dhcp_server_new(&server, 1) >= 0);
assert_se(sd_dhcp_server_attach_event(server, NULL, 0) >= 0);
assert_se(sd_dhcp_server_configure_pool(server, &address, 24, 0, 0) >= 0);