]> git.ipfire.org Git - thirdparty/git.git/commit
receive-pack: fix crash on out-of-namespace symref
authorTroels Thomsen <troels@thomsen.io>
Sat, 27 Dec 2025 15:40:14 +0000 (15:40 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 28 Dec 2025 05:05:41 +0000 (14:05 +0900)
commit57f7dd48d79302a095b56fa4019b537b4f4fd60d
tree2903a0045e29dfea3c6b48bc203414589c0361cb
parent9a2fb147f2c61d0cab52c883e7e26f5b7948e3ed
receive-pack: fix crash on out-of-namespace symref

`check_aliased_update_internal()` detects when a symbolic ref and its
target are being updated in the same push. It does this by building a
list of ref names without the optional namespace prefix. When a symbolic
ref within a namespace points to a ref outside the namespace,
`strip_namespace()` returns NULL which leads to a segfault.

A NULL check preventing this particular issue was repurposed in
ded8393610. Rather than reintroducing it, we can instead build a list of
fully qualified ref names. This prevents the crash, preserves the
consistency check from da3efdb17b, and allows updates to all symbolic
refs.

Signed-off-by: Troels Thomsen <troels@thomsen.io>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c
t/t5509-fetch-push-namespaces.sh