]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/conf-parser: fix crash when specifiers cannot be resolved in config_parse_devi...
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 13 Mar 2018 11:25:06 +0000 (12:25 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 14 Mar 2018 15:50:08 +0000 (16:50 +0100)
oss-fuzz #6885.

TODO
src/core/load-fragment.c
test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6885 [new file with mode: 0644]
test/fuzz-regressions/meson.build

diff --git a/TODO b/TODO
index f171121f693c409dba95f3f08486e3dab0ffa46a..d5e37e49acd3c09fb71f3760f90cf20a4bb22070 100644 (file)
--- a/TODO
+++ b/TODO
@@ -528,6 +528,7 @@ Features:
 * maybe add a generator that looks for "systemd.run=" on the kernel cmdline for container usercases...
 
 * test/:
+  - add unit tests for config_parse_device_allow()
 
 * seems that when we follow symlinks to units we prefer the symlink
   destination path over /etc and /usr. We should not do that. Instead
index f2f9267b92018d3e193f0099e71fcfc81d0acc75..7f56149ead96ffc943ea04176442180180e2754f 100644 (file)
@@ -410,7 +410,6 @@ int config_parse_socket_listen(const char *unit,
                 if (r < 0) {
                         if (r != -EAFNOSUPPORT)
                                 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse address value, ignoring: %s", rvalue);
-
                         return 0;
                 }
 
@@ -3511,6 +3510,7 @@ int config_parse_device_allow(
                 log_syntax(unit, LOG_WARNING, filename, line, r,
                            "Failed to resolve specifiers in %s, ignoring: %m",
                            rvalue);
+                return 0;
         }
 
         n = strcspn(t, WHITESPACE);
diff --git a/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6885 b/test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6885
new file mode 100644 (file)
index 0000000..1859136
--- /dev/null
@@ -0,0 +1,3 @@
+service
+[Service]
+DeviceAllow=%D
\ No newline at end of file
index c1416f93cf3cfd926dec7e1fc07cf37babdf4cf6..9753c61882f95646e5a32b451c83e836ae4e6354 100644 (file)
@@ -30,4 +30,5 @@ fuzz_regression_tests = '''
         fuzz-dns-packet/oss-fuzz-5465
         fuzz-dns-packet/issue-7888
         fuzz-unit-file/oss-fuzz-6884
+        fuzz-unit-file/oss-fuzz-6885
 '''.split()