aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jelen <[email protected]>2024-05-28 14:50:59 +0000
committerWerner Koch <[email protected]>2024-05-29 09:57:30 +0000
commita1f85fdc40e4ebb0bc59fa72104a2297ad427c10 (patch)
tree9578c80f8132877a1bee212e72bc482c44f5f614
parentwks: Make sure that ERR is always initialized. (diff)
downloadgnupg-a1f85fdc40e4ebb0bc59fa72104a2297ad427c10.tar.gz
gnupg-a1f85fdc40e4ebb0bc59fa72104a2297ad427c10.zip
agent: Avoid uninitialized access in GENKEY command on parameter error.
* agent/command.c (cmd_genkey): Moved init_membuf to the top. -- Signed-off-by: Jakub Jelen <[email protected]> This is part of GnuPG-bug-id: 7129 (cherry picked from commit 379fc5569d604c4a7b5f12b2bbfc4106893c2a9e)
-rw-r--r--agent/command.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/agent/command.c b/agent/command.c
index 940e017d8..04b024ef6 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -876,6 +876,8 @@ cmd_genkey (assuan_context_t ctx, char *line)
time_t opt_timestamp;
int c;
+ init_membuf (&outbuf, 512);
+
if (ctrl->restricted)
return leave_cmd (ctx, gpg_error (GPG_ERR_FORBIDDEN));
@@ -928,8 +930,6 @@ cmd_genkey (assuan_context_t ctx, char *line)
if (rc)
return rc;
- init_membuf (&outbuf, 512);
-
/* If requested, ask for the password to be used for the key. If
this is not used the regular Pinentry mechanism is used. */
if (opt_inq_passwd && !no_protection)