1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

fuzz: do not assume the existence of /sys/class/net/lo

Hopefully fixes oss-fuzz#13440.
This commit is contained in:
Yu Watanabe 2019-02-28 14:02:33 +09:00 committed by Lennart Poettering
parent dc16327c48
commit 358fb6862b

View File

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "device-internal.h"
#include "device-private.h"
#include "fd-util.h"
#include "fs-util.h"
@ -19,7 +20,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
assert_se(fwrite(data, size, 1, f) == 1);
fflush(f);
assert_se(sd_device_new_from_syspath(&dev, "/sys/class/net/lo") >= 0);
assert_se(device_new_aux(&dev) >= 0);
(void) device_read_db_internal_filename(dev, filename);
return 0;
}