summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2024-09-03 07:06:48 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2024-09-03 07:06:48 +0200
commit4a4c1efac59f92b318b350265d1cc7b8365fcbdf (patch)
treecfedbc595b4944a0fdbf8447962c736b75b0804e /agent
parenttests: Add two plaintext test mails (diff)
downloadgnupg2-4a4c1efac59f92b318b350265d1cc7b8365fcbdf.tar.xz
gnupg2-4a4c1efac59f92b318b350265d1cc7b8365fcbdf.zip
agent: Fix KEYTOCARD for the use case with loopback pinentry.
* agent/command.c (cmd_keytocard): Copy LINE. -- GnuPG-bug-id: 7283 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'agent')
-rw-r--r--agent/command.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/agent/command.c b/agent/command.c
index 3012680a1..580d1cb10 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -3291,6 +3291,12 @@ cmd_keytocard (assuan_context_t ctx, char *line)
force = has_option (line, "--force");
line = skip_options (line);
+ /* Need a copy of LINE, since it might inquire to the frontend which
+ resulted original buffer overwritten. */
+ line = xtrystrdup (line);
+ if (!line)
+ return gpg_error_from_syserror ();
+
argc = split_fields (line, argv, DIM (argv));
if (argc < 3)
{
@@ -3410,6 +3416,7 @@ cmd_keytocard (assuan_context_t ctx, char *line)
xfree (keydata);
leave:
+ xfree (line);
xfree (ecdh_params);
gcry_sexp_release (s_skey);
xfree (shadow_info);