1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

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 <jjelen@redhat.com>

This is part of
GnuPG-bug-id: 7129

(cherry picked from commit 379fc5569d604c4a7b5f12b2bbfc4106893c2a9e)
This commit is contained in:
Jakub Jelen 2024-05-28 16:50:59 +02:00 committed by Werner Koch
parent ebf9e3b824
commit a1f85fdc40
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -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)