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

gpg-auth: Fix use after free.

* tools/gpg-auth.c (ssh_authorized_keys): Move free after printing error
message.
--

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
This is part of
GnuPG-bug-id: 7129
This commit is contained in:
Jakub Jelen 2024-05-28 17:19:37 +02:00 committed by Werner Koch
parent dcb0b6fd48
commit 9adaa79ab4
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -818,7 +818,6 @@ ssh_authorized_keys (const char *user, struct ssh_key_list **r_ssh_key_list)
xfree (fname); xfree (fname);
return err; return err;
} }
xfree (fname);
maxlen = 2048; /* Set limit. */ maxlen = 2048; /* Set limit. */
while ((len = es_read_line (fp, &line, &length_of_line, &maxlen)) > 0) while ((len = es_read_line (fp, &line, &length_of_line, &maxlen)) > 0)
@ -861,6 +860,7 @@ ssh_authorized_keys (const char *user, struct ssh_key_list **r_ssh_key_list)
*r_ssh_key_list = ssh_key_list; *r_ssh_key_list = ssh_key_list;
leave: leave:
xfree (fname);
xfree (line); xfree (line);
es_fclose (fp); es_fclose (fp);
return err; return err;