summaryrefslogtreecommitdiffstats
path: root/usr.bin/uudecode/uudecode.c
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-04-20 02:33:30 +0000
committerjmallett <jmallett@FreeBSD.org>2002-04-20 02:33:30 +0000
commit64ae9117d81e6a0e9da72d3464a44f2592137b52 (patch)
tree09939c7b1b64453702ba4527d86f505b3f200087 /usr.bin/uudecode/uudecode.c
parenta65eab0c346b3fd412a6e32a97e9e45801a6a5b0 (diff)
downloadFreeBSD-src-64ae9117d81e6a0e9da72d3464a44f2592137b52.zip
FreeBSD-src-64ae9117d81e6a0e9da72d3464a44f2592137b52.tar.gz
base64_decode() was feeding \r and \n to the decoding function, and that
was causing output to be corrupted. Pointed out by: obrien MFC after: 3 days
Diffstat (limited to 'usr.bin/uudecode/uudecode.c')
-rw-r--r--usr.bin/uudecode/uudecode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.bin/uudecode/uudecode.c b/usr.bin/uudecode/uudecode.c
index 7d812dd..4f54aaa 100644
--- a/usr.bin/uudecode/uudecode.c
+++ b/usr.bin/uudecode/uudecode.c
@@ -342,6 +342,10 @@ base64_decode(stream)
unsigned char out[MAXPATHLEN * 4];
int rv;
+ if (index(stream, '\r') != NULL)
+ *index(stream, '\r') = '\0';
+ if (index(stream, '\n') != NULL)
+ *index(stream, '\n') = '\0';
rv = b64_pton(stream, out, (sizeof(out) / sizeof(out[0])));
if (rv == -1)
errx(1, "b64_pton: error decoding base64 input stream");
OpenPOWER on IntegriCloud