[hackers] [sbase] Make the buffer 45 bytes exactly for uuencode(1) || sin

From: <git_AT_suckless.org>
Date: Fri, 31 Jan 2014 16:45:30 +0100

commit cb5733ea414e36d179f44c2aa04b606321a9197e
Author: sin <sin_AT_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
_AT_@ -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) {
Received on Fri Jan 31 2014 - 16:45:30 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 31 2014 - 16:48:13 CET