aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jelen <[email protected]>2024-05-28 15:19:37 +0000
committerWerner Koch <[email protected]>2024-05-29 09:49:10 +0000
commitf54944693376d27447bbd3c6758edff53a23eb64 (patch)
tree30d19ba0029db14d812c98a16814d8404bc7647e
parentgpgsm: Avoid double free when checking rsaPSS signatures. (diff)
downloadgnupg-f54944693376d27447bbd3c6758edff53a23eb64.tar.gz
gnupg-f54944693376d27447bbd3c6758edff53a23eb64.zip
gpg-auth: Fix use after free.
* tools/gpg-auth.c (ssh_authorized_keys): Move free after printing error message. -- Signed-off-by: Jakub Jelen <[email protected]> This is part of GnuPG-bug-id: 7129 (cherry picked from commit 9adaa79ab43e2f87178b8ee5ab1a353cba384606)
-rw-r--r--tools/gpg-auth.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/gpg-auth.c b/tools/gpg-auth.c
index f433ba220..b6778a14b 100644
--- a/tools/gpg-auth.c
+++ b/tools/gpg-auth.c
@@ -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;