Re: [PATCH 2/7] gpg-interface: make signature-prefix matching length-aware
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 17, 2026, 19:32 UTC
- Message-ID
- <xmqqa4pfu11i.fsf@gitster.g>
- In-Reply-To
- <3fc7774ba867a10f35f7a74424baa4527f038232.1789667556.git.gitgitgadget@gmail.com>
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 8 quoted lines
> @@ -669,7 +669,7 @@ int check_signature(struct signature_check *sigc,
> sigc->result = 'N';
> sigc->trust_level = TRUST_UNDEFINED;
>
> - fmt = get_format_by_sig(signature);
> + fmt = get_format_by_sig(signature, slen);
> if (!fmt)
> die(_("bad/incompatible signature '%s'"), signature);All the existing callers of check_signature() pass a NUL-terminated buffer which is <buf, len> pair of a strbuf. Another approach that may be simpler is to drop the slen parameter from check_signature().