commit cb5733ea414e36d179f44c2aa04b606321a9197e
parent b60882f2064e58c5e4cf98a2987e2d1022315ee4
Author: sin <sin@2f30.org>
Date: Fri, 31 Jan 2014 15:43:37 +0000
Make the buffer 45 bytes exactly for uuencode(1)
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git 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\n", 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) {