summaryrefslogtreecommitdiff
path: root/src/fuzz
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-02-26 13:12:53 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-02-26 13:13:02 +0100
commitd92e7b8fe46e450726106c7289d5ce36f6c3c611 (patch)
treeac871f8d0e8700261ccd0445746ecb17b1231459 /src/fuzz
parenteafadd069c4e30ed62173123326a7237448615d1 (diff)
downloadsystemd-d92e7b8fe46e450726106c7289d5ce36f6c3c611.tar.gz
fuzz-lldp: avoid assertion failure on samples which dont fit in pipe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11603.
Diffstat (limited to 'src/fuzz')
-rw-r--r--src/fuzz/fuzz-lldp.c3
-rw-r--r--src/fuzz/fuzz-lldp.options2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/fuzz/fuzz-lldp.c b/src/fuzz/fuzz-lldp.c
index b9291d4783..7f252309cd 100644
--- a/src/fuzz/fuzz-lldp.c
+++ b/src/fuzz/fuzz-lldp.c
@@ -23,6 +23,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
_cleanup_(sd_lldp_unrefp) sd_lldp *lldp = NULL;
+ if (size > 2048)
+ return 0;
+
assert_se(sd_event_new(&e) == 0);
assert_se(sd_lldp_new(&lldp) >= 0);
assert_se(sd_lldp_set_ifindex(lldp, 42) >= 0);
diff --git a/src/fuzz/fuzz-lldp.options b/src/fuzz/fuzz-lldp.options
new file mode 100644
index 0000000000..60bd9b0b2f
--- /dev/null
+++ b/src/fuzz/fuzz-lldp.options
@@ -0,0 +1,2 @@
+[libfuzzer]
+max_len = 2048