gpgconf: Fix argv overflow if --homedir is used.

* tools/gpgconf-comp.c (gc_component_launch): Fix crash due to too
small array.
--

GnuPG-bug-id: 5366

Depending on the stack layout this could have led to zeroing out the
PID variable if --homedir was used and thus under Windows to a leaked
handle.  However, gpgconf is a short running process and thus no
really harm.

Co-authored-by: cbiedl@gnupg.com
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2021-03-26 14:47:10 +01:00
parent 87d7b7e075
commit a50093893c
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 2 additions and 1 deletions

View File

@ -1260,7 +1260,7 @@ gc_component_launch (int component)
{
gpg_error_t err;
const char *pgmname;
const char *argv[5];
const char *argv[6];
int i;
pid_t pid;
@ -1300,6 +1300,7 @@ gc_component_launch (int component)
argv[i++] = "--dirmngr";
argv[i++] = "NOP";
argv[i] = NULL;
log_assert (i < DIM(argv));
err = gnupg_spawn_process_fd (pgmname, argv, -1, -1, -1, &pid);
if (!err)