1
0
mirror of https://github.com/systemd/systemd.git synced 2025-09-30 17:45:02 +03:00

tmpfiles: use allocated buffer for path

Paths can in principle be longer then PATH_MAX, so
simply allocate the buffer with malloc().

CID #1237773
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2014-10-01 07:33:22 -05:00
parent fdb14b7ef4
commit 9348f0e690

View File

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