From 9e3a9ff2ab4c4090ec09f502a5c56cec369e0726 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 efb8e419035844..b7accda3bd57c6 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -497,7 +497,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);