shared/conf-parser: fix crash when specifiers cannot be resolved in config_parse_device_allow()

oss-fuzz #6885.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-03-13 12:25:06 +01:00
parent 0d032da993
commit 20d52ab60e
4 changed files with 6 additions and 1 deletions

1
TODO
View File

@ -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

View 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);

View File

@ -0,0 +1,3 @@
service
[Service]
DeviceAllow=%D

View 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()