diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-01-31 00:34:13 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-02-10 22:41:39 +0100 |
commit | fdc2c3a926c21e24986677abd02c8bc568a5de32 (patch) | |
tree | 1ee77daa3090efe28fa2fc2659863fba6e2793d3 /t/t4122-apply-symlink-inside.sh | |
parent | apply: do not read from the filesystem under --index (diff) | |
download | git-fdc2c3a926c21e24986677abd02c8bc568a5de32.tar.xz git-fdc2c3a926c21e24986677abd02c8bc568a5de32.zip |
apply: do not read from beyond a symbolic link
We should reject a patch, whether it renames/copies dir/file to
elsewhere with or without modificiation, or updates dir/file in
place, if "dir/" part is actually a symbolic link to elsewhere,
by making sure that the code to read the preimage does not read
from a path that is beyond a symbolic link.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-x | t/t4122-apply-symlink-inside.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t4122-apply-symlink-inside.sh b/t/t4122-apply-symlink-inside.sh index 70b3a06e1d..035c080581 100755 --- a/t/t4122-apply-symlink-inside.sh +++ b/t/t4122-apply-symlink-inside.sh @@ -52,4 +52,23 @@ test_expect_success 'check result' ' ' +test_expect_success SYMLINKS 'do not read from beyond symbolic link' ' + git reset --hard && + mkdir -p arch/x86_64/dir && + >arch/x86_64/dir/file && + git add arch/x86_64/dir/file && + echo line >arch/x86_64/dir/file && + git diff >patch && + git reset --hard && + + mkdir arch/i386/dir && + >arch/i386/dir/file && + ln -s ../i386/dir arch/x86_64/dir && + + test_must_fail git apply patch && + test_must_fail git apply --cached patch && + test_must_fail git apply --index patch + +' + test_done |