mirror of
https://github.com/git-for-windows/git.git
synced 2026-07-04 18:24:31 -05:00
fixup! Refuse to follow invalid paths in .git files
TortoiseGit actually compiles kind of a "libified" version of this, where the `die()` calls are substituted with C++ `throw` constructs. Therefore the (`static`, stays allocated even after returning from the function) `realpath` actually _can_ be reused. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
2
setup.c
2
setup.c
@@ -1047,6 +1047,7 @@ const char *read_gitfile_gently(const char *path, int *return_error_code)
|
||||
}
|
||||
#if (defined _WIN32 || defined __WIN32__)
|
||||
if (is_dir_sep(dir[0]) && is_invalid_dotgit_path(path, dir)) {
|
||||
strbuf_reset(&realpath);
|
||||
strbuf_add(&realpath, dir, strlen(dir));
|
||||
path = realpath.buf;
|
||||
goto cleanup_return;
|
||||
@@ -1057,6 +1058,7 @@ const char *read_gitfile_gently(const char *path, int *return_error_code)
|
||||
goto cleanup_return;
|
||||
}
|
||||
|
||||
strbuf_reset(&realpath);
|
||||
strbuf_realpath(&realpath, dir, 1);
|
||||
path = realpath.buf;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user