From: Michael Haggerty <mhagger@xxxxxxxxxxxx> Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx> --- abspath.c | 3 +++ t/t0000-basic.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/abspath.c b/abspath.c index 5d62430..3e8325c 100644 --- a/abspath.c +++ b/abspath.c @@ -35,6 +35,9 @@ const char *real_path(const char *path) if (path == buf || path == next_buf) return path; + if (!*path) + die("The empty string is not a valid path"); + if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX) die ("Too long path: %.*s", 60, path); diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 363e190..1a51634 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -454,7 +454,7 @@ test_expect_success 'absolute path rejects the empty string' ' test_must_fail test-path-utils absolute_path "" ' -test_expect_failure 'real path rejects the empty string' ' +test_expect_success 'real path rejects the empty string' ' test_must_fail test-path-utils real_path "" ' -- 1.7.11.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html