From 45a7becfeaba0ab50b1aae9cddbb5c32789d56b2 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Sat, 29 Sep 2018 02:47:18 +0000 Subject: [PATCH] tests: make fuzz-dhcp6-client work in containers provided by the OSS-Fuzz project The containers come with an empty machine-id, which causes the fuzzer to fail as soon as it starts. See https://github.com/systemd/systemd/pull/9014#discussion_r189594104 --- src/libsystemd-network/dhcp-identifier.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/dhcp-identifier.c index 531cf67..77c584e 100644 --- a/src/libsystemd-network/dhcp-identifier.c +++ b/src/libsystemd-network/dhcp-identifier.c @@ -108,8 +108,13 @@ int dhcp_identifier_set_duid_en(struct duid *duid, size_t *len) { assert(len); r = sd_id128_get_machine(&machine_id); - if (r < 0) + if (r < 0) { +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + machine_id = SD_ID128_MAKE(01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10); +#else return r; +#endif + } unaligned_write_be16(&duid->type, DUID_TYPE_EN); unaligned_write_be32(&duid->en.pen, SYSTEMD_PEN); -- 2.7.4