upstream: reset comment=NULL for each key in do_fingerprint();

fixes "no comment" not showing on when running `ssh-keygen -l` on multiple
keys where one has a comment and other following keys do not. Patch from
Markus Kuhn via GHPR407, bz3580

OpenBSD-Commit-ID: 3cce84456fdcd67dc6b84e369f92c6686d111d9b
This commit is contained in:
djm@openbsd.org 2023-06-20 00:05:09 +00:00 committed by Damien Miller
parent b53a809a54
commit b4ac435b4e
No known key found for this signature in database
1 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-keygen.c,v 1.467 2023/04/12 08:53:54 jsg Exp $ */
/* $OpenBSD: ssh-keygen.c,v 1.468 2023/06/20 00:05:09 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -997,6 +997,7 @@ do_fingerprint(struct passwd *pw)
* accept a public key prefixed with a hostname or options.
* Try a bare key first, otherwise skip the leading stuff.
*/
comment = NULL;
if ((public = try_read_key(&cp)) == NULL) {
i = strtol(cp, &ep, 10);
if (i == 0 || ep == NULL ||