Hi,
While changing comments on ssh-key, I saw some vfprintf in log:
Feb 6 14:24:44 clyde ssh-keygen: vfprintf %s NULL in "Key now has comment '%s'
"
Steps to reproduce:
$ ssh-keygen -f test -C ''
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in test.
Your public key has been saved in test.pub.
The key fingerprint is:
SHA256:Pz26unhH1NsOx3JDcKTLaBpKvdadRG+tnJXZKI17io4
The key's randomart image is:
+---[RSA 2048]----+
| .. |
| ... |
| .oo |
| . .+.=.o+|
| . S.o *==o+|
| . . B.++**+ |
| . +.+ **=. |
| o...+ +. |
| ..E==.. |
+----[SHA256]-----+
$ ssh-keygen -c -C 'test' -o -f test
Key now has comment '(null)'
The comment in your key file has been changed.
The following diff should correct it.
As side note, I found the output of ssh-keygen a bit confusing as the
printed comment is the old one (but it could be due to english isn't my
native language).
--
Sebastien Marie
Index: ssh-keygen.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/ssh-keygen.c,v
retrieving revision 1.292
diff -u -p -r1.292 ssh-keygen.c
--- ssh-keygen.c 12 Sep 2016 03:29:16 -0000 1.292
+++ ssh-keygen.c 6 Feb 2017 13:27:40 -0000
@@ -1425,7 +1425,10 @@ do_change_comment(struct passwd *pw)
sshkey_free(private);
exit(1);
}
- printf("Key now has comment '%s'\n", comment);
+ if (comment)
+ printf("Key now has comment '%s'\n", comment);
+ else
+ printf("Key now has no comment\n");
if (identity_comment) {
strlcpy(new_comment, identity_comment, sizeof(new_comment));