From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH 2/7] gpg-interface: make signature-prefix matching length-aware
Date: Fri, 18 Sep 2026 01:59:11 -0700 [thread overview]
Message-ID: <xmqq1parorz4.fsf@gitster.g> (raw)
In-Reply-To: <e20a33ef-181c-6dae-ce9a-8dfbc5d560b0@gmx.de> (Johannes Schindelin's message of "Fri, 18 Sep 2026 09:12:32 +0200 (CEST)")
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> That holds for six of the seven call sites: `commit.c`, `tag.c`,
> `builtin/fast-import.c`, `fmt-merge-msg.c`, and `log-tree.c` (twice).
> `builtin/receive-pack.c` is a minor wrinkle worth flagging: it passes
> `push_cert.buf + bogs` ("bogs" = "beginning_of_gpg_sig") and
> `push_cert.len - bogs`, an offset sub-buffer of `push_cert`, not that
> strbuf's own buf/len pair verbatim. It still ends on `push_cert`'s own
> terminating NUL, so the observation holds in spirit, but strictly the
> pattern is "ends at some strbuf's own NUL", which is more a matter of
> code-review convention across call sites than something
> `check_signature()`'s own signature guarantees.
Yes but the audit was "is slen our callers pass redundant?", and not
"does everybody pass strbuf and we are better off passing a pionter
to a strbuf?". And the answer to the former question is "yes".
And I do not quite understand or agree with the logic here.
> ... Applying the same "audit
> today's callers and assume it holds" reasoning to `check_signature()` now
> risks reproducing that failure mode a second time.
What I was saying was to force all current *and* *future* callers to
pass NUL-terminated string by removing slen.
Having said all that, I think this falls into "once the code is
written (and more importantly, once it is reviewed, as that is a lot
more costly part of the development process for machine written
code), it is not worth going back and change it, as the difference
is not large enough either way."
next prev parent reply other threads:[~2026-09-18 8:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 17:52 [PATCH 0/7] Fix issues pointed out in Git for Windows by Coverity after merging v2.56.0-rc0 Johannes Schindelin via GitGitGadget
2026-09-17 17:52 ` [PATCH 1/7] wrapper: guard writev_in_full() against signed overflow Johannes Schindelin via GitGitGadget
2026-09-17 17:52 ` [PATCH 2/7] gpg-interface: make signature-prefix matching length-aware Johannes Schindelin via GitGitGadget
2026-09-17 19:32 ` Junio C Hamano
2026-09-18 7:12 ` Johannes Schindelin
2026-09-18 8:59 ` Junio C Hamano [this message]
2026-09-17 17:52 ` [PATCH 3/7] midx: validate incremental MIDX pack IDs Johannes Schindelin via GitGitGadget
2026-09-17 17:52 ` [PATCH 4/7] rerere: do not record failed conflict resolution data Johannes Schindelin via GitGitGadget
2026-09-17 19:34 ` Junio C Hamano
2026-09-17 17:52 ` [PATCH 5/7] t/unit-tests: check reftable iterator initialization Johannes Schindelin via GitGitGadget
2026-09-17 17:52 ` [PATCH 6/7] oss-fuzz: handle reftable iterator initialization failures Johannes Schindelin via GitGitGadget
2026-09-17 17:52 ` [PATCH 7/7] test-read-midx: check midx_fill_entry() result Johannes Schindelin via GitGitGadget
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=xmqq1parorz4.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox