absolute_path(): reject the empty string
[gitweb.git] / abspath.c
index f04ac18e33063f7e2cb9ab9eab9a6b86cb089b5a..5d624307d5a68ced9ff07c7c19e2ac603c67def6 100644 (file)
--- a/abspath.c
+++ b/abspath.c
@@ -123,7 +123,9 @@ const char *absolute_path(const char *path)
 {
        static char buf[PATH_MAX + 1];
 
-       if (is_absolute_path(path)) {
+       if (!*path) {
+               die("The empty string is not a valid path");
+       } else if (is_absolute_path(path)) {
                if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
                        die("Too long path: %.*s", 60, path);
        } else {