From 009d482fd16aa1960458660ee803f23449e2c3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Fri, 15 Nov 2019 10:43:41 +0000 Subject: [PATCH] Be careful with dirname() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- src/ctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ctl.c b/src/ctl.c index b094862..f52a2b2 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -34,8 +34,9 @@ ctl_rundir(char *dst, size_t size) continue; memcpy(path, dst, ret + 1); + char *p = dirname(path); - if (!access(dirname(path), W_OK)) + if (p && !access(p, W_OK)) return dst; }