1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 11:55:23 +03:00

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
This commit is contained in:
Evgeny Vereshchagin 2018-09-29 02:47:18 +00:00
parent d89a400ed6
commit 45a7becfea

View File

@ -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);