aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2024-09-03 05:06:48 +0000
committerWerner Koch <[email protected]>2024-09-03 09:15:57 +0000
commit95468f531c3b6299becb801d74c6cd2bd9baac96 (patch)
treef39f6b688e124831b6b03987595c5a7f736d5088
parentgpgconf: Add missing linefeed to the -X output. (diff)
downloadgnupg-95468f531c3b6299becb801d74c6cd2bd9baac96.tar.gz
gnupg-95468f531c3b6299becb801d74c6cd2bd9baac96.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 <[email protected]>
-rw-r--r--agent/command.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/agent/command.c b/agent/command.c
index 04b024ef6..1be033824 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -2700,6 +2700,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)
{
@@ -2820,6 +2826,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);