Re: [PATCH v2 00/21] object_id part 7
- From
Jeff King <peff@peff.net>
- Date
- Mar 28, 2017, 20:00 UTC
- Message-ID
- <20170328200007.rlewwl6py6l7vhp6@sigill.intra.peff.net>
- In-Reply-To
- <xmqqfuhxchqq.fsf@gitster.mtv.corp.google.com>
On Tue, Mar 28, 2017 at 12:40:29PM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> > Here's that minor tweak, in case anybody is interested. It's less useful > > without that follow-on that touches "eol" more, but perhaps it increases > > readability on its own. > > Yup, the only thing that the original (with Brian's fix) appears to > be more careful about is it tries very hard to avoid setting boc > past eoc. As we are not checking "boc != eoc" but doing the > comparison, that "careful" appearance does not give us any benefit > in practice, other than having to do an extra "eol ? eol+1 : eoc"; > the result of this patch is easier to read. > > By the way, eoc is "one past the end" of the array that begins at > boc, so setting a pointer to eoc+1 may technically be in violation. > I do not know how much it matters, though ;-)
I think that is OK. We are reading a strbuf, so eoc must either be the first character of the PGP signature, or the terminating NUL if there was no signature block[1]. So it's actually _inside_ the array, and eoc+1 is our "one past".
-Peff
[1] Arguably we should bail when parse_signature() does not find a PGP
signature at all. We already bail with "malformed push certificate"
when there are other syntactic anomalies.