scd: Fix length error for READKEY.
authorNIIBE Yutaka <gniibe@fsij.org>
Fri, 4 Nov 2016 06:34:35 +0000 (15:34 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Fri, 4 Nov 2016 06:34:35 +0000 (15:34 +0900)
* scd/app-openpgp.c (do_readkey): Decrement the length.

--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
scd/app-openpgp.c

index 4bf99ad..f8d9954 100644 (file)
@@ -1770,6 +1770,8 @@ do_readkey (app_t app, int advanced, const char *keyid,
 
       gcry_sexp_sprint (s_key, GCRYSEXP_FMT_ADVANCED, *pk, *pklen);
       gcry_sexp_release (s_key);
+      /* Decrement for trailing '\0' */
+      *pklen = *pklen - 1;
     }
   else
     {