From 8c7c38a8a07d12d6ea5a3acddcb3f0d808fbb941 Mon Sep 17 00:00:00 2001 From: pedro martelletto Date: Fri, 26 Nov 2021 17:11:43 +0100 Subject: [PATCH] gpg-interface: trim CR from ssh-keygen -Y find-principals We need to trim \r from the output of 'ssh-keygen -Y find-principals' on Windows, or we end up calling 'ssh-keygen -Y verify' with a bogus signer identity. ssh-keygen.c:2841 contains a call to puts(3), which confirms this hypothesis. Signature verification passes with the fix. Signed-off-by: pedro martelletto --- gpg-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpg-interface.c b/gpg-interface.c index bb5c37057b..3458841138 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -509,7 +509,7 @@ static int verify_ssh_signed_buffer(struct signature_check *sigc, if (!*line) break; - trust_size = strcspn(line, "\n"); + trust_size = strcspn(line, "\r\n"); principal = xmemdupz(line, trust_size); child_process_init(&ssh_keygen);