From a16d732a51f93853f2595ead7c14632646610d75 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 16 Feb 2021 08:48:37 +0100 Subject: [PATCH] fuzz-systemctl-parse-argv: avoid "leak" of bus object Memory sanitizer would report leaked memory from --boot-load-entry=help. Maybe we should disable all bus connections from the fuzzer? It seems not appropriate to communicate with logind. OTOH, in a real fuzzing environment this call should just fail, so maybe that's OK. --- src/systemctl/fuzz-systemctl-parse-argv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/systemctl/fuzz-systemctl-parse-argv.c b/src/systemctl/fuzz-systemctl-parse-argv.c index f884917e17..cf66fa4bb7 100644 --- a/src/systemctl/fuzz-systemctl-parse-argv.c +++ b/src/systemctl/fuzz-systemctl-parse-argv.c @@ -9,6 +9,7 @@ #include "stdio-util.h" #include "strv.h" #include "systemctl.h" +#include "systemctl-util.h" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { _cleanup_strv_free_ char **argv = NULL; @@ -54,5 +55,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { assert_se(freopen(path, "w", stdout)); } + release_busses(); /* We open the bus for communication with logind. + * It needs to be closed to avoid apparent leaks. */ return 0; } -- 2.25.1