[PATCH gnupg] agent: Avoid appending a '\0' byte to the response of READKEY

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH gnupg] agent: Avoid appending a '\0' byte to the response of READKEY

Katsuhiro Ueno
* 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 7c7e8a4..36a21ae 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -1062,7 +1062,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);
             }
         }
--
2.16.1


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH gnupg] agent: Avoid appending a '\0' byte to the response of READKEY

Werner Koch
On Wed,  7 Feb 2018 10:52, [hidden email] said:
> * agent/command.c (cmd_readkey): Set pkbuflen to the length of the output
> without an extra '\0' byte.

Thanks.

If you intend to send more patches, please post a DCO; see doc/HACKING
for details.


Salam-Shalom,

   Werner

--
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

attachment0 (233 bytes) Download Attachment