]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: don't screw up ssh-keygen -l output when the file
authordjm@openbsd.org <djm@openbsd.org>
Wed, 4 Dec 2024 14:24:20 +0000 (14:24 +0000)
committerDamien Miller <djm@mindrot.org>
Wed, 4 Dec 2024 14:28:55 +0000 (01:28 +1100)
contains CR characters; GHPR236 bz3385, fix from Dmitry Belyavskiy

OpenBSD-Commit-ID: e458cf6b0adcea5b69ef4c7ba38e590841d02ef4

ssh-keygen.c

index f7ea069684c5c2be722eee23f45675d3e617949e..89c3ed28762826f954334706b1b99aa5f7a9c4f2 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.476 2024/10/18 05:37:24 djm Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.477 2024/12/04 14:24:20 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1008,7 +1008,7 @@ do_fingerprint(struct passwd *pw)
        while (getline(&line, &linesize, f) != -1) {
                lnum++;
                cp = line;
-               cp[strcspn(cp, "\n")] = '\0';
+               cp[strcspn(cp, "\r\n")] = '\0';
                /* Trim leading space and comments */
                cp = line + strspn(line, " \t");
                if (*cp == '#' || *cp == '\0')