chiark / gitweb /
util: be a bit safer in path_is_safe()
[elogind.git] / src / shared / util.c
index 693bb1d9a4b338d68bb2f911a778cf0bbc7b67af..f904d03257f1b63e43d578ddd5c65b0b3aee744a 100644 (file)
@@ -3918,7 +3918,7 @@ bool path_is_safe(const char *p) {
         if (streq(p, "..") || startswith(p, "../") || endswith(p, "/..") || strstr(p, "/../"))
                 return false;
 
-        if (strlen(p) > PATH_MAX)
+        if (strlen(p)+1 > PATH_MAX)
                 return false;
 
         /* The following two checks are not really dangerous, but hey, they still are confusing */