]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fuzz-unit-file: fix check if ListenNetlink is used 8523/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 21 Mar 2018 12:16:25 +0000 (13:16 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 21 Mar 2018 12:16:52 +0000 (13:16 +0100)
A line may contain leading spaces which we should skip.
Fixes https://oss-fuzz.com/v2/issue/5546208027213824/7049.

src/fuzz/fuzz-unit-file.c

index 44c68db64dd97ac36f74800f00fcc04b3c244f8b..4865653f5bff9183bf30c4d29c5477196c431076 100644 (file)
@@ -41,11 +41,14 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
 
         for (;;) {
                 _cleanup_free_ char *l = NULL;
+                const char *ll;
 
                 if (read_line(f, LINE_MAX, &l) <= 0)
                         break;
 
-                if (startswith(l, "ListenNetlink="))
+                ll = l + strspn(l, WHITESPACE);
+
+                if (startswith(ll, "ListenNetlink="))
                         /* ListenNetlink causes a false positive in msan,
                          * let's skip this for now. */
                         return 0;