From aeedab62f7ab73f1acc7edc1a9c500217ee0b3fd Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 7 Aug 2016 16:13:28 -0300 Subject: [PATCH] eeshow/git-file.c (canonical_path_into_repo): really catch divergent paths --- eeshow/git-file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eeshow/git-file.c b/eeshow/git-file.c index 8972df4..26ff1c6 100644 --- a/eeshow/git-file.c +++ b/eeshow/git-file.c @@ -237,15 +237,16 @@ static char *canonical_path_into_repo(const char *repo_dir, const char *path) path_st.st_ino == repo_st.st_ino) break; + slash = strrchr(tmp, '/'); + /* "this cannot happen" */ - if (tail == tmp) { + if (tail == tmp || !slash) { fprintf(stderr, "divergent paths:\nrepo \"%s\"\nobject \"%s\"\n", - repo_dir, tmp); + repo_dir, tail); exit(1); } - slash = strrchr(tmp, '/'); if (tail != end) tail[-1] = '/'; tail = slash + 1;