From 22bd96c5ada0f657d4a4f2829980babee58bae11 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 10 Dec 2018 14:54:22 +0100 Subject: [PATCH] daemon: fix creation of chroot directory Because the current path was uninitialized, we were creating semi-random directory at the root of the filesystem. --- NEWS | 4 ++++ src/daemon/priv.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index fdd7b1da..cd606215 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +lldpd (1.0.3) + * Fix: + + Fix creation of chroot directory. + lldpd (1.0.2) * Changes: + On Linux, the monitor process will now drop its privileges diff --git a/src/daemon/priv.c b/src/daemon/priv.c index bf9fb550..f4d6bdf4 100644 --- a/src/daemon/priv.c +++ b/src/daemon/priv.c @@ -513,7 +513,7 @@ sig_chld(int sig) /* Create a directory recursively. */ static int mkdir_p(const char *pathname, mode_t mode) { - char path[PATH_MAX+1], current[PATH_MAX+1]; + char path[PATH_MAX+1], current[PATH_MAX+1] = {}; char *tok; if (strlcpy(path, pathname, sizeof(path)) >= sizeof(path)) { -- 2.39.5