]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: fix use-after-free in do_download_sk; ok djm
authormarkus@openbsd.org <markus@openbsd.org>
Fri, 6 Mar 2020 18:29:14 +0000 (18:29 +0000)
committerDamien Miller <djm@mindrot.org>
Fri, 13 Mar 2020 02:18:31 +0000 (13:18 +1100)
OpenBSD-Commit-ID: 96b49623d297797d4fc069f1f09e13c8811f8863

ssh-keygen.c

index 3c6c9a18c40165d1f9a4f507ec491030174f3789..aa4ec0655938bc4960877d8ea34c7261b6bca6de 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.401 2020/03/06 18:15:04 markus Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.402 2020/03/06 18:29:14 markus Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -3025,9 +3025,9 @@ do_download_sk(const char *skprovider, const char *device)
                free(path);
                if ((r = sshkey_save_public(keys[i], pubpath,
                    keys[i]->sk_application)) != 0) {
-                       free(pubpath);
                        error("Saving public key \"%s\" failed: %s",
                            pubpath, ssh_err(r));
+                       free(pubpath);
                        break;
                }
                free(pubpath);