]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fuzz-unit-file: adjust check for ListenNetlink yet again
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 25 Mar 2018 20:11:44 +0000 (22:11 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 26 Mar 2018 08:42:19 +0000 (10:42 +0200)
The test for ListenNetlink would abort the loop if a line longer then LINE_MAX
was encountered (read_line() returns -ENOBUFS in that case). Let's use the
the line length limit that the unit file parses uses.

https://oss-fuzz.com/v2/issue/5546208027213824/7094.

src/fuzz/fuzz-unit-file.c

index 4865653f5bff9183bf30c4d29c5477196c431076..a5cd9b4aa9cd20837c8ff6ddc1809cb1a5b47262 100644 (file)
@@ -43,15 +43,17 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
                 _cleanup_free_ char *l = NULL;
                 const char *ll;
 
-                if (read_line(f, LINE_MAX, &l) <= 0)
+                if (read_line(f, LONG_LINE_MAX, &l) <= 0)
                         break;
 
                 ll = l + strspn(l, WHITESPACE);
 
-                if (startswith(ll, "ListenNetlink="))
+                if (startswith(ll, "ListenNetlink=")) {
                         /* ListenNetlink causes a false positive in msan,
                          * let's skip this for now. */
+                        log_notice("Skipping test because ListenNetlink= is present");
                         return 0;
+                }
         }
 
         assert_se(fseek(f, offset, SEEK_SET) == 0);