summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/fuzz-lldp-rx.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-lldp-rx.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-lldp-rx.c')
-rw-r--r--src/libsystemd-network/fuzz-lldp-rx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libsystemd-network/fuzz-lldp-rx.c b/src/libsystemd-network/fuzz-lldp-rx.c
index 2d8e201854..64f96ae2cb 100644
--- a/src/libsystemd-network/fuzz-lldp-rx.c
+++ b/src/libsystemd-network/fuzz-lldp-rx.c
@@ -26,6 +26,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (outside_size_range(size, 0, 2048))
return 0;
+ fuzz_setup_logging();
+
assert_se(sd_event_new(&e) == 0);
assert_se(sd_lldp_rx_new(&lldp_rx) >= 0);
assert_se(sd_lldp_rx_set_ifindex(lldp_rx, 42) >= 0);