From 2259f3d335ca40c4a9550057ea91fafc67bdbc07 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 25 May 2018 14:06:51 +0100 Subject: [PATCH] Fix null deref on writing OpenSSH pubkey with no comment. If we're called on to generate the one-line OpenSSH public key format for a key that we don't have a comment field for, we were mistakenly testing this by checking if '*comment' rather than 'comment' was zero, i.e. if comment was NULL we'd dereference it by mistake. --- sshpubk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sshpubk.c b/sshpubk.c index c60b9dfc..1198a009 100644 --- a/sshpubk.c +++ b/sshpubk.c @@ -1502,7 +1502,7 @@ static char *ssh2_pubkey_openssh_str_internal(const char *comment, i += n; p += 4; } - if (*comment) { + if (comment) { *p++ = ' '; strcpy(p, comment); } else