summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-01 07:33:22 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-01 08:43:09 -0400
commit9348f0e690c28f86a69c96e3e9b9f19a31c6d466 (patch)
tree3fbe0f00e0036fa764ca3681c5bd8ef8c588d3f7
parentfdb14b7ef40d1f19f3bd7c8fa2a3821c2be87a5e (diff)
tmpfiles: use allocated buffer for path
Paths can in principle be longer then PATH_MAX, so simply allocate the buffer with malloc(). CID #1237773
-rw-r--r--src/tmpfiles/tmpfiles.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 7eafd6bb30..dafb9aee2f 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1064,7 +1064,7 @@ static int clean_item(Item *i) {
static int process_item(Item *i) {
int r, q, p;
- char prefix[PATH_MAX];
+ _cleanup_free_ char *prefix = NULL;
assert(i);
@@ -1073,6 +1073,10 @@ static int process_item(Item *i) {
i->done = true;
+ prefix = malloc(strlen(i->path) + 1);
+ if (!prefix)
+ return log_oom();
+
PATH_FOREACH_PREFIX(prefix, i->path) {
Item *j;