aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command-ssh.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2019-05-21 06:50:28 +0000
committerNIIBE Yutaka <[email protected]>2019-05-21 06:50:28 +0000
commit479f7bf31ce405e558d844c3eb576b463a8697e5 (patch)
treeb1a1239d7471b47f567357269ec0542c0e35db4e /agent/command-ssh.c
parentgpg: Do not delete any keys if --dry-run is passed. (diff)
downloadgnupg-479f7bf31ce405e558d844c3eb576b463a8697e5.tar.gz
gnupg-479f7bf31ce405e558d844c3eb576b463a8697e5.zip
agent: For SSH key, don't put NUL-byte at the end.
* agent/command-ssh.c (ssh_key_to_protected_buffer): Update the length by the second call of gcry_sexp_sprint. -- GnuPG-bug-id: 4502 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/command-ssh.c')
-rw-r--r--agent/command-ssh.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index 5f7884b1f..0849a06fc 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -3007,8 +3007,8 @@ ssh_key_to_protected_buffer (gcry_sexp_t key, const char *passphrase,
goto out;
}
- gcry_sexp_sprint (key, GCRYSEXP_FMT_CANON, buffer_new, buffer_new_n);
- /* FIXME: guarantee? */
+ buffer_new_n = gcry_sexp_sprint (key, GCRYSEXP_FMT_CANON,
+ buffer_new, buffer_new_n);
if (*passphrase)
err = agent_protect (buffer_new, passphrase, buffer, buffer_n, 0, -1);