Be careful with dirname()

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2019-11-15 10:43:41 +00:00
parent b9aaab661f
commit 009d482fd1

View File

@@ -34,8 +34,9 @@ ctl_rundir(char *dst, size_t size)
continue; continue;
memcpy(path, dst, ret + 1); memcpy(path, dst, ret + 1);
char *p = dirname(path);
if (!access(dirname(path), W_OK)) if (p && !access(p, W_OK))
return dst; return dst;
} }