summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/uuencode.c
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/ssh/uuencode.c
parentba08124ef132a43146f229ee67092b9efd4706de (diff)
remote trailing comments before calling __b64_pton
Diffstat (limited to 'usr.bin/ssh/uuencode.c')
-rw-r--r--usr.bin/ssh/uuencode.c18
1 files changed, 16 insertions, 2 deletions
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