git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/7] gpg-interface: make signature-prefix matching length-aware

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 18, 2026, 08:59 UTC
Message-ID
<xmqq1parorz4.fsf@gitster.g>
In-Reply-To
<e20a33ef-181c-6dae-ce9a-8dfbc5d560b0@gmx.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 10 quoted lines
> 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."

Previous: Johannes SchindelinNext: Johannes Schindelin via GitGitGadget
Message 6 of 12 in “Fix issues pointed out in Git for Windows by Coverity after merging v2.56.0-rc0”
  1. 0/7 Fix issues pointed out in Git for Windows by Coverity after merging v2.56.0-rc0Johannes Schindelin via GitGitGadget, Sep 17, 2026
  2. 1/7 wrapper: guard writev_in_full() against signed overflowJohannes Schindelin via GitGitGadget, Sep 17, 2026
  3. 2/7 gpg-interface: make signature-prefix matching length-awareJohannes Schindelin via GitGitGadget, Sep 17, 2026
  4. Junio C HamanoSep 17, 2026
  5. Johannes SchindelinSep 18, 2026
  6. Junio C HamanoSep 18, 2026
  7. 3/7 midx: validate incremental MIDX pack IDsJohannes Schindelin via GitGitGadget, Sep 17, 2026
  8. 4/7 rerere: do not record failed conflict resolution dataJohannes Schindelin via GitGitGadget, Sep 17, 2026
  9. Junio C HamanoSep 17, 2026
  10. 5/7 t/unit-tests: check reftable iterator initializationJohannes Schindelin via GitGitGadget, Sep 17, 2026
  11. 6/7 oss-fuzz: handle reftable iterator initialization failuresJohannes Schindelin via GitGitGadget, Sep 17, 2026
  12. 7/7 test-read-midx: check midx_fill_entry() resultJohannes Schindelin via GitGitGadget, Sep 17, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.