All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] connect: plug protocol capability leak
Date: Mon, 8 Dec 2025 08:26:00 +0100	[thread overview]
Message-ID: <aTZ9iMPKLAfd-GSt@pks.im> (raw)
In-Reply-To: <xmqqfr9mnbu9.fsf@gitster.g>

On Sun, Dec 07, 2025 at 01:40:46PM +0900, Junio C Hamano wrote:
> When pushing to a set of remotes using a nickname for the group, the
> client initializes the connection to each remote, talks to the
> remote and reads and parses capabilities line, and holds the
> capabilities in a file-scope static variable server_capabilities_v1.
> 
> There are a few other such file-scope static variables, and these
> connections cannot be parallelized until they are refactored to a
> structure that keeps track of active connections.
> 
> Which is *not* the theme of this patch ;-)
> 
> For a single connection, the server_capabilities_v1 variable is
> initialized to NULL (at the program initialization), populated when
> we talk to the other side, used to look up capabilities of the other
> sdie possible multiple times, and the memory is held by the variable

s/sdie/side/

> diff --git a/connect.c b/connect.c
> index 8352b71faf..c6f76e3082 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -240,6 +240,8 @@ static void process_capabilities(struct packet_reader *reader, size_t *linelen)
>  	size_t nul_location = strlen(line);
>  	if (nul_location == *linelen)
>  		return;
> +
> +	free(server_capabilities_v1);
>  	server_capabilities_v1 = xstrdup(line + nul_location + 1);
>  	*linelen = nul_location;

This looks obviously correct.

> diff --git a/t/meson.build b/t/meson.build
> index d3d0be2822..459c52a489 100644
> --- a/t/meson.build
> +++ b/t/meson.build
> @@ -690,6 +690,7 @@ integration_tests = [
>    't5562-http-backend-content-length.sh',
>    't5563-simple-http-auth.sh',
>    't5564-http-proxy.sh',
> +  't5565-push-multiple.sh',
>    't5570-git-daemon.sh',
>    't5571-pre-push-hook.sh',
>    't5572-pull-submodule.sh',
> diff --git a/t/t5565-push-multiple.sh b/t/t5565-push-multiple.sh
> new file mode 100755
> index 0000000000..7e93668566
> --- /dev/null
> +++ b/t/t5565-push-multiple.sh

Nit: we have several tests in t5505 that are related to push groups, so
we might want to add this new test over there. I don't care too much
though, so please feel free to ignore this nit.

Thanks!

Patrick

  reply	other threads:[~2025-12-08  7:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-07  4:40 [PATCH] connect: plug protocol capability leak Junio C Hamano
2025-12-08  7:26 ` Patrick Steinhardt [this message]
2025-12-08 13:37   ` Junio C Hamano
2025-12-08 20:18 ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aTZ9iMPKLAfd-GSt@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.