summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-11 16:57:02 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-11 23:41:42 -0500
commite01ff428993f0c126f010b5625002e6a0a8aff4a (patch)
tree3d26a90ff3c157668dda700094829a1623ba8f5d /src/core
parent4d8629de8bd0f837f99981267d10e71d1f72e47d (diff)
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.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/load-fragment.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index eea415883b..242b684ddf 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -589,7 +589,8 @@ int config_parse_exec(const char *unit,
}
found:
- n = new(char*, k + !separate_argv0);
+ /* If seperate_argv0, we'll move first element to path variable */
+ n = new(char*, MAX(k + !separate_argv0, 1u));
if (!n)
return log_oom();