mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-09-08 14:41:51 +00:00
core/load-fragment: avoid allocating 0 bytes when given an invalid command
With a command line like "@/something" we would allocate an array with
0 elements. Avoid that, and add a test too.
(cherry picked from commit e01ff42899)
Conflicts:
src/core/load-fragment.c
src/test/test-unit-file.c
This commit is contained in:
@@ -581,7 +581,8 @@ int config_parse_exec(const char *unit,
|
||||
}
|
||||
|
||||
found:
|
||||
n = new(char*, k + !honour_argv0);
|
||||
/* If seperate_argv0, we'll move first element to path variable */
|
||||
n = new(char*, MAX(k + !honour_argv0, 1u));
|
||||
if (!n)
|
||||
return log_oom();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user