Re: [PATCH 2/3] credential: teach `credential_from_url()` a non-strict mode
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 22, 2020, 23:02 UTC
- Message-ID
- <xmqqd07zi0p6.fsf@gitster.c.googlers.com>
- In-Reply-To
- <nycvar.QRO.7.76.6.2004230042370.18039@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 7 quoted lines
> It is not obvious from the diff: `url` is never changed. It would still > point at the first `h`, as you said. > >> > + if (slash - url > 0) >> > + c->host = url_decode_mem(host, slash - host); > ... > I guess a better condition would be `if (proto_end || slash - host > 0)`.
Yeah, that would probably be more intuitive to read. What triggered my reaction was the mismatch between "slash - url" in the condition and "slash - host" that specifies the length of the memory region.