File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
gix-worktree/tests/fixtures Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 3
3
set -eu
4
4
5
5
repo=" $1 "
6
+ target_bin=' .cargo/bin'
7
+
6
8
git init -- " $repo "
7
9
cd -- " $repo "
8
10
9
- cat > ls.tmp << 'EOF '
11
+ cat > payload << 'EOF '
10
12
#!/bin/sh
11
13
printf 'Vulnerable!\n'
12
14
date >~/vulnerable
13
15
exec /bin/ls "$@"
14
16
EOF
15
- chmod +x ls.tmp
17
+ chmod +x payload
16
18
17
19
upward=' ..'
18
20
for subdir in .a .b .c .d .e .f .g .h .i .j; do
19
- upward=" ..@$upward "
20
- cp -- ls.tmp " $subdir @$upward @.cargo@bin@ls"
21
+ upward=" ../$upward "
22
+ target=" $subdir /$upward /$target_bin /ls"
23
+ standin=" $( printf ' %s' " $target " | tr / @) "
24
+
21
25
mkdir -- " $subdir "
22
26
touch -- " $subdir /.keep"
27
+ cp -- payload " $standin "
28
+ git add -- " $subdir /.keep" " $standin "
29
+
30
+ standin_pattern=" $( printf ' %s' " $standin " | sed ' s|\.|\\\.|g' ) "
31
+ cp .git/index old_index
32
+ sed " s|$standin_pattern |$target |g" old_index > .git/index
23
33
done
24
34
25
- rm ls.tmp
26
- git add .
27
- ex -s -c ' %s/@\.\./\/../g' -c ' %s/@\.cargo@bin@ls/\/.cargo\/bin\/ls/g' -c ' x' .git/index
28
35
git commit -m ' Initial commit'
36
+ rm payload old_index
29
37
git show --stat
You can’t perform that action at this time.
0 commit comments