diff options
author | 2000-05-05 18:53:42 +0000 | |
---|---|---|
committer | 2000-05-05 18:53:42 +0000 | |
commit | 7add2f408fdfd3e63b267e24a4ba6c193b63e7e2 (patch) | |
tree | d462e73908c77abefca35a79e8c937c4f45e6322 | |
parent | log failure before sending the reply (diff) | |
download | wireguard-openbsd-7add2f408fdfd3e63b267e24a4ba6c193b63e7e2.tar.xz wireguard-openbsd-7add2f408fdfd3e63b267e24a4ba6c193b63e7e2.zip |
remote trailing comments before calling __b64_pton
-rw-r--r-- | usr.bin/ssh/key.c | 4 | ||||
-rw-r--r-- | usr.bin/ssh/radix.c | 3 | ||||
-rw-r--r-- | usr.bin/ssh/uuencode.c | 18 |
3 files changed, 22 insertions, 3 deletions
diff --git a/usr.bin/ssh/key.c b/usr.bin/ssh/key.c index 572317a6416..ae355a3fcdc 100644 --- a/usr.bin/ssh/key.c +++ b/usr.bin/ssh/key.c @@ -255,6 +255,10 @@ key_read(Key *ret, char **cpp) len = 2*strlen(cp); blob = xmalloc(len); n = uudecode(cp, blob, len); + if (n < 0) { + error("uudecode %s failed", cp); + return 0; + } k = dsa_key_from_blob(blob, n); if (k == NULL) return 0; diff --git a/usr.bin/ssh/radix.c b/usr.bin/ssh/radix.c index 4a8e9df069b..03377334415 100644 --- a/usr.bin/ssh/radix.c +++ b/usr.bin/ssh/radix.c @@ -131,7 +131,8 @@ radix_to_creds(const char *buf, CREDENTIALS *creds) char version; char temp[2048]; - if (!(len = uudecode(buf, (unsigned char *)temp, sizeof(temp)))) + len = uudecode(buf, (unsigned char *)temp, sizeof(temp)); + if (len < 0) return 0; p = temp; diff --git a/usr.bin/ssh/uuencode.c b/usr.bin/ssh/uuencode.c index a67040b2fb1..fc84d5a5830 100644 --- a/usr.bin/ssh/uuencode.c +++ b/usr.bin/ssh/uuencode.c @@ -10,13 +10,27 @@ int uuencode(unsigned char *src, unsigned int srclength, char *target, size_t targsize) { - return b64_ntop(src, srclength, target, targsize); + return __b64_ntop(src, srclength, target, targsize); } int uudecode(const char *src, unsigned char *target, size_t targsize) { - return b64_pton(src, target, targsize); + int len; + char *encoded, *p; + + /* copy the 'readonly' source */ + encoded = xstrdup(src); + /* skip whitespace and data */ + for (p = encoded; *p == ' ' || *p == '\t'; p++) + ; + for (; *p != '\0' && *p != ' ' && *p != '\t'; p++) + ; + /* and remote trailing whitespace because __b64_pton needs this */ + *p = '\0'; + len = __b64_pton(encoded, target, targsize); + xfree(encoded); + return len; } void |