Merge branch 'en/serve-promisor-remote-fix'

A client requesting the promisor-remote capability without a value
caused a null pointer dereference, which has been corrected by
rejecting a request without an argument.

* en/serve-promisor-remote-fix:
  serve: reject valueless promisor-remote capability
main
Junio C Hamano 2026-08-24 13:17:51 -07:00
commit bc4c56690e
2 changed files with 14 additions and 0 deletions

View File

@ -46,6 +46,9 @@ static int promisor_remote_advertise(struct repository *r,
static void promisor_remote_receive(struct repository *r,
const char *remotes)
{
if (!remotes)
die("promisor-remote capability requires an argument");

mark_promisor_remotes_as_accepted(r, remotes);
}


View File

@ -71,6 +71,17 @@ test_expect_success 'request invalid capability' '
test_grep "unknown capability" err
'

test_expect_success 'promisor-remote capability requires an argument' '
test-tool pkt-line pack >in <<-EOF &&
command=ls-refs
object-format=$(test_oid algo)
promisor-remote
0000
EOF
test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
test_grep "promisor-remote capability requires an argument" err
'

test_expect_success 'request with no command' '
test-tool pkt-line pack >in <<-EOF &&
agent=git/test