]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/clone: abort when hardlinked source and target file differ
authorPatrick Steinhardt <ps@pks.im>
Mon, 15 Apr 2024 11:30:31 +0000 (13:30 +0200)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 16 Apr 2024 22:01:25 +0000 (00:01 +0200)
commitd1bb66a546b4bb46005d17ba711caaad26f26c1e
treecfa3c90be2598a17fbbe09fd3caadb9aee6aacbd
parent150e6b0aedf57d224c3c49038c306477fa159886
builtin/clone: abort when hardlinked source and target file differ

When performing local clones with hardlinks we refuse to copy source
files which are symlinks as a mitigation for CVE-2022-39253. This check
can be raced by an adversary though by changing the file to a symlink
after we have checked it.

Fix the issue by checking whether the hardlinked destination file
matches the source file and abort in case it doesn't.

This addresses CVE-2024-32021.

Reported-by: Apple Product Security <product-security@apple.com>
Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
builtin/clone.c