aboutsummaryrefslogtreecommitdiffstats
path: root/t/t0060-path-utils.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-09-16 13:26:40 +0200
committerJohannes Schindelin <johannes.schindelin@gmx.de>2019-12-05 15:37:09 +0100
commit65d30a19de282d781c59bb7f807459cb5b29de1e (patch)
treece238c2e1919a98b6079d1d81c69d3e464d754c9 /t/t0060-path-utils.sh
parentMerge branch 'fix-mingw-quoting-bug' (diff)
parentmingw: refuse to access paths with trailing spaces or periods (diff)
downloadgit-65d30a19de282d781c59bb7f807459cb5b29de1e.tar.gz
git-65d30a19de282d781c59bb7f807459cb5b29de1e.zip
Merge branch 'win32-filenames-cannot-have-trailing-spaces-or-periods'
On Windows, filenames cannot have trailing spaces or periods, when opening such paths, they are stripped automatically. Read: you can open the file `README` via the file name `README . . .`. This ambiguity can be used in combination with other security bugs to cause e.g. remote code execution during recursive clones. This patch series fixes that. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 't/t0060-path-utils.sh')
-rwxr-xr-xt/t0060-path-utils.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index 2b8589e921..1171e0bb88 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -440,4 +440,18 @@ test_expect_success 'match .gitmodules' '
.gitmodules,:\$DATA
'
+test_expect_success MINGW 'is_valid_path() on Windows' '
+ test-path-utils is_valid_path \
+ win32 \
+ "win32 x" \
+ ../hello.txt \
+ \
+ --not \
+ "win32 " \
+ "win32 /x " \
+ "win32." \
+ "win32 . ." \
+ .../hello.txt
+'
+
test_done