summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2000-05-05 18:53:43 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2000-05-05 18:53:43 +0000
commit26a12994911b71b41fa46e4f2ca5d28b31c6c4d3 (patch)
treefd66cc9ac741cd41fcbc30b667224113d5b71b64 /usr.bin
parentba08124ef132a43146f229ee67092b9efd4706de (diff)
remote trailing comments before calling __b64_pton
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/key.c4
-rw-r--r--usr.bin/ssh/radix.c3
-rw-r--r--usr.bin/ssh/uuencode.c18
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