From f73371931686f16c2b5df49cb6a4b16c5fdfe79c Mon Sep 17 00:00:00 2001 From: Jiang Xin Date: Mon, 1 Nov 2021 10:14:17 +0800 Subject: i18n: fix typos found during l10n for git 2.34.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Emir and Jean-Noël reported typos in some i18n messages when preparing l10n for git 2.34.0. * Fix unstable spelling of config variable "gpg.ssh.defaultKeyCommand" which was introduced in commit fd9e226776 (ssh signing: retrieve a default key from ssh-agent, 2021-09-10). * Add missing space between "with" and "--python" which was introduced in commit bd0708c7eb (ref-filter: add %(raw) atom, 2021-07-26). * Fix unmatched single quote in 'builtin/index-pack.c' which was introduced in commit 8737dab346 (index-pack: refactor renaming in final(), 2021-09-09) [1] https://github.com/git-l10n/git-po/pull/567 Reported-by: Emir Sarı Reported-by: Jean-Noël Avila Signed-off-by: Jiang Xin Signed-off-by: Junio C Hamano --- gpg-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gpg-interface.c') diff --git a/gpg-interface.c b/gpg-interface.c index 800d8caa67..68d2f29be7 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -775,7 +775,7 @@ static const char *get_default_ssh_signing_key(void) if (keys[0] && starts_with(keys[0]->buf, "ssh-")) { default_key = strbuf_detach(keys[0], NULL); } else { - warning(_("gpg.ssh.defaultKeycommand succeeded but returned no keys: %s %s"), + warning(_("gpg.ssh.defaultKeyCommand succeeded but returned no keys: %s %s"), key_stderr.buf, key_stdout.buf); } -- cgit v1.3 From 18b18503e3b3721e0a513cbc83971a960e944c19 Mon Sep 17 00:00:00 2001 From: René Scharfe Date: Sat, 30 Oct 2021 19:04:56 +0200 Subject: gpg-interface: handle missing " with " gracefully in parse_ssh_output() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the output of ssh-keygen starts with "Good \"git\" signature for ", but is not followed by " with " for some reason, then parse_ssh_output() uses -1 as the len parameter of xmemdupz(), which in turn will end the program. Reject the signature and carry on instead in that case. Signed-off-by: René Scharfe Acked-by: Fabian Stelzer Signed-off-by: Junio C Hamano --- gpg-interface.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gpg-interface.c') diff --git a/gpg-interface.c b/gpg-interface.c index 800d8caa67..62d340e78a 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -387,10 +387,6 @@ static void parse_ssh_output(struct signature_check *sigc) line = to_free = xmemdupz(sigc->output, strcspn(sigc->output, "\n")); if (skip_prefix(line, "Good \"git\" signature for ", &line)) { - /* Valid signature and known principal */ - sigc->result = 'G'; - sigc->trust_level = TRUST_FULLY; - /* Search for the last "with" to get the full principal */ principal = line; do { @@ -398,6 +394,12 @@ static void parse_ssh_output(struct signature_check *sigc) if (search) line = search + 1; } while (search != NULL); + if (line == principal) + goto cleanup; + + /* Valid signature and known principal */ + sigc->result = 'G'; + sigc->trust_level = TRUST_FULLY; sigc->signer = xmemdupz(principal, line - principal - 1); } else if (skip_prefix(line, "Good \"git\" signature with ", &line)) { /* Valid signature, but key unknown */ -- cgit v1.3 From 65db97b4fa6b03059f2f14f313e07ca799d4ef3f Mon Sep 17 00:00:00 2001 From: René Scharfe Date: Sat, 30 Oct 2021 19:07:38 +0200 Subject: gpg-interface: avoid buffer overrun in parse_ssh_output() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the string "key" we found in the output of ssh-keygen happens to be located at the very end of the line, then going four characters further leaves us beyond the end of the string. Explicitly search for the space after "key" to handle a missing one gracefully. Signed-off-by: René Scharfe Acked-by: Fabian Stelzer Signed-off-by: Junio C Hamano --- gpg-interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gpg-interface.c') diff --git a/gpg-interface.c b/gpg-interface.c index 62d340e78a..3838536f0a 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -409,9 +409,9 @@ static void parse_ssh_output(struct signature_check *sigc) goto cleanup; } - key = strstr(line, "key"); + key = strstr(line, "key "); if (key) { - sigc->fingerprint = xstrdup(strstr(line, "key") + 4); + sigc->fingerprint = xstrdup(strstr(line, "key ") + 4); sigc->key = xstrdup(sigc->fingerprint); } else { /* -- cgit v1.3