upstream: fix use-after-free in do_download_sk; ok djm

OpenBSD-Commit-ID: 96b49623d297797d4fc069f1f09e13c8811f8863
This commit is contained in:
markus@openbsd.org 2020-03-06 18:29:14 +00:00 committed by Damien Miller
parent 5732d58020
commit e32ef97a56

View 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> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * 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); free(path);
if ((r = sshkey_save_public(keys[i], pubpath, if ((r = sshkey_save_public(keys[i], pubpath,
keys[i]->sk_application)) != 0) { keys[i]->sk_application)) != 0) {
free(pubpath);
error("Saving public key \"%s\" failed: %s", error("Saving public key \"%s\" failed: %s",
pubpath, ssh_err(r)); pubpath, ssh_err(r));
free(pubpath);
break; break;
} }
free(pubpath); free(pubpath);