commit cb5733ea414e36d179f44c2aa04b606321a9197e
Author: sin <s...@2f30.org>
Date:   Fri Jan 31 15:43:37 2014 +0000

    Make the buffer 45 bytes exactly for uuencode(1)

diff --git a/uuencode.c b/uuencode.c
index 3b7a716..0766e39 100644
--- a/uuencode.c
+++ b/uuencode.c
@@ -44,14 +44,14 @@ static void
 uuencode(FILE *fp, const char *name, const char *s)
 {
        struct stat st;
-       unsigned char buf[80], *p;
+       unsigned char buf[45], *p;
        ssize_t n;
        int ch;
 
        if (fstat(fileno(fp), &st) < 0)
                eprintf("fstat %s:", s);
        fprintf(stdout, "begin %o %s
", st.st_mode & 0777, name);
-       while ((n = fread(buf, 1, 45, fp))) {
+       while ((n = fread(buf, 1, sizeof(buf), fp))) {
                ch = ' ' + (n & 0x3f);
                putchar(ch == ' ' ? '`' : ch);
                for (p = buf; n > 0; n -= 3, p += 3) {


Reply via email to