Re: [PATCH] connect: plug protocol capability leak
- From
Jeff King <peff@peff.net>
- Date
- Dec 8, 2025, 20:18 UTC
- Message-ID
- <20251208201856.GB216526@coredump.intra.peff.net>
- In-Reply-To
- <xmqqfr9mnbu9.fsf@gitster.g>
On Sun, Dec 07, 2025 at 01:40:46PM +0900, Junio C Hamano wrote:
Show 13 quoted lines
> 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; >
The fix looks obviously correct.
I couldn't help but notice that "v1" here is a little confusing, as it is really "v0". Or I guess if you want to be pedantic, "v1" is v0 with the extra useless version string probe that nobody actually sends. So it technically is also the v1 capabilities string, but I think v0 is more descriptive.
Anyway, way off the topic of your patch, and maybe not even worth fixing independently. I removed a couple of confusing "v1 protocol" mentions in the test suite, but I don't know if this one would actually bother anyone.
-Peff