1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-10 21:38:50 +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
(cherry picked from commit 9adaa79ab4)
This commit is contained in:
Jakub Jelen 2024-05-28 17:19:37 +02:00 committed by Werner Koch
parent ece154562f
commit f549446933
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);
return err;
}
xfree (fname);
maxlen = 2048; /* Set limit. */
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;
leave:
xfree (fname);
xfree (line);
es_fclose (fp);
return err;