From df97fe24807826ddc2af0e45e416fb81c5666f88 Mon Sep 17 00:00:00 2001 From: Katsuhiro Ueno Date: Wed, 7 Feb 2018 18:52:37 +0900 Subject: [PATCH] agent: Avoid appending a '\0' byte to the response of READKEY * agent/command.c (cmd_readkey): Set pkbuflen to the length of the output without an extra '\0' byte. --- agent/command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agent/command.c b/agent/command.c index 3a547ffaa..f9bc6ca96 100644 --- a/agent/command.c +++ b/agent/command.c @@ -1031,7 +1031,8 @@ cmd_readkey (assuan_context_t ctx, char *line) rc = gpg_error_from_syserror (); else { - gcry_sexp_sprint (s_pkey, GCRYSEXP_FMT_CANON, pkbuf, pkbuflen); + pkbuflen = gcry_sexp_sprint (s_pkey, GCRYSEXP_FMT_CANON, + pkbuf, pkbuflen); rc = assuan_send_data (ctx, pkbuf, pkbuflen); } }