chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fdb14b7
)
tmpfiles: use allocated buffer for path
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 1 Oct 2014 12:33:22 +0000
(07:33 -0500)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 1 Oct 2014 12:43:09 +0000
(08:43 -0400)
Paths can in principle be longer then PATH_MAX, so
simply allocate the buffer with malloc().
CID #
1237773
src/tmpfiles/tmpfiles.c
patch
|
blob
|
history
diff --git
a/src/tmpfiles/tmpfiles.c
b/src/tmpfiles/tmpfiles.c
index 7eafd6bb30791eb3d1922d58f73a4fc9ccf06d2c..dafb9aee2f7e56be1c3a94d90c99206731d45822 100644
(file)
--- 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;