summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/key.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2000-05-24 18:26:47 +0000
committermarkus <markus@openbsd.org>2000-05-24 18:26:47 +0000
commit4ad2f8be3822f13913aa56d8e8579e77511bef5b (patch)
tree31f84d52350918faf916d77190cd64290db26483 /usr.bin/ssh/key.c
parentreturn ENOSYS for NFSSVC_BIOD request. since none to call it anyway (diff)
downloadwireguard-openbsd-4ad2f8be3822f13913aa56d8e8579e77511bef5b.tar.xz
wireguard-openbsd-4ad2f8be3822f13913aa56d8e8579e77511bef5b.zip
fix key_read() for uuencoded keys w/o '='
Diffstat (limited to 'usr.bin/ssh/key.c')
-rw-r--r--usr.bin/ssh/key.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.bin/ssh/key.c b/usr.bin/ssh/key.c
index ae355a3fcdc..d474f85c666 100644
--- a/usr.bin/ssh/key.c
+++ b/usr.bin/ssh/key.c
@@ -256,12 +256,14 @@ key_read(Key *ret, char **cpp)
blob = xmalloc(len);
n = uudecode(cp, blob, len);
if (n < 0) {
- error("uudecode %s failed", cp);
+ error("key_read: uudecode %s failed", cp);
return 0;
}
k = dsa_key_from_blob(blob, n);
- if (k == NULL)
- return 0;
+ if (k == NULL) {
+ error("key_read: dsa_key_from_blob %s failed", cp);
+ return 0;
+ }
xfree(blob);
if (ret->dsa != NULL)
DSA_free(ret->dsa);
@@ -269,10 +271,12 @@ key_read(Key *ret, char **cpp)
k->dsa = NULL;
key_free(k);
bits = BN_num_bits(ret->dsa->p);
- cp = strchr(cp, '=');
- if (cp == NULL)
- return 0;
- *cpp = cp + 1;
+ /* advance cp: skip whitespace and data */
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ while (*cp != '\0' && *cp != ' ' && *cp != '\t')
+ cp++;
+ *cpp = cp;
break;
default:
fatal("key_read: bad key type: %d", ret->type);