summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/sshkey.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2015-01-12 20:13:27 +0000
committermarkus <markus@openbsd.org>2015-01-12 20:13:27 +0000
commit16c474a910ce54da5455ddd64c89cc71c8da66dd (patch)
tree1224006964a1fc6f82f928afcb08d42c90b3ee1f /usr.bin/ssh/sshkey.c
parentrevert the namecache embiggening since it seems to cause hangs at reboot. (diff)
downloadwireguard-openbsd-16c474a910ce54da5455ddd64c89cc71c8da66dd.tar.xz
wireguard-openbsd-16c474a910ce54da5455ddd64c89cc71c8da66dd.zip
unbreak parsing of pubkey comments; with gerhard; ok djm/deraadt
Diffstat (limited to 'usr.bin/ssh/sshkey.c')
-rw-r--r--usr.bin/ssh/sshkey.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/ssh/sshkey.c b/usr.bin/ssh/sshkey.c
index 4421bff08f7..1fd3136340f 100644
--- a/usr.bin/ssh/sshkey.c
+++ b/usr.bin/ssh/sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.c,v 1.9 2015/01/12 13:29:27 markus Exp $ */
+/* $OpenBSD: sshkey.c,v 1.10 2015/01/12 20:13:27 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -1251,8 +1251,14 @@ sshkey_read(struct sshkey *ret, char **cpp)
return SSH_ERR_ALLOC_FAIL;
/* trim comment */
space = strchr(cp, ' ');
- if (space)
- *space = '\0';
+ if (space) {
+ /* advance 'space': skip whitespace */
+ *space++ = '\0';
+ while (*space == ' ' || *space == '\t')
+ space++;
+ *cpp = space;
+ } else
+ *cpp = cp + strlen(cp);
if ((r = sshbuf_b64tod(blob, cp)) != 0) {
sshbuf_free(blob);
return r;
@@ -1327,12 +1333,6 @@ sshkey_read(struct sshkey *ret, char **cpp)
sshkey_free(k);
if (retval != 0)
break;
- /* advance cp: skip whitespace and data */
- while (*cp == ' ' || *cp == '\t')
- cp++;
- while (*cp != '\0' && *cp != ' ' && *cp != '\t')
- cp++;
- *cpp = cp;
break;
default:
return SSH_ERR_INVALID_ARGUMENT;