diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index e00f732a..a4436be1 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -8598,3 +8598,15 @@ subst.c - valid_parameter_transform: new function, reject transformations longer than a single character or invalid transformation operators - parameter_brace_transform: call valid_parameter_transform + + 6/22 + ---- +lib/sh/zread.c + - lbuf: bump size up to ZBUFSIZ (default 4096). From a report by + Jason A. Donenfeld + +lib/sh/zcatfd.c + - zcatfd: lbuf: bump size up to ZBUFSIZ (default 4096) + +lib/sh/zmapfd.c + - zmapfd: lbuf: bump size up to ZBUFSIZ (default 4096) diff --git a/lib/sh/zcatfd.c b/lib/sh/zcatfd.c index f9a2322e..aa8199fd 100644 --- a/lib/sh/zcatfd.c +++ b/lib/sh/zcatfd.c @@ -34,6 +34,10 @@ extern int errno; #endif +#ifndef ZBUFSIZ +# define ZBUFSIZ 4096 +#endif + extern ssize_t zread PARAMS((int, char *, size_t)); extern int zwrite PARAMS((int, char *, ssize_t)); @@ -46,7 +50,7 @@ zcatfd (fd, ofd, fn) { ssize_t nr; int rval; - char lbuf[1024]; + char lbuf[ZBUFSIZ]; rval = 0; while (1) diff --git a/lib/sh/zmapfd.c b/lib/sh/zmapfd.c index f3fb8473..f9e9ed71 100644 --- a/lib/sh/zmapfd.c +++ b/lib/sh/zmapfd.c @@ -36,6 +36,10 @@ extern int errno; #endif +#ifndef ZBUFSIZ +# define ZBUFSIZ 4096 +#endif + extern ssize_t zread PARAMS((int, char *, size_t)); /* Dump contents of file descriptor FD to *OSTR. FN is the filename for @@ -48,12 +52,12 @@ zmapfd (fd, ostr, fn) { ssize_t nr; int rval; - char lbuf[512]; + char lbuf[ZBUFSIZ]; char *result; int rsize, rind; rval = 0; - result = (char *)xmalloc (rsize = 512); + result = (char *)xmalloc (rsize = ZBUFSIZ); rind = 0; while (1) @@ -72,7 +76,7 @@ zmapfd (fd, ostr, fn) return -1; } - RESIZE_MALLOCED_BUFFER (result, rind, nr, rsize, 512); + RESIZE_MALLOCED_BUFFER (result, rind, nr, rsize, ZBUFSIZ); memcpy (result+rind, lbuf, nr); rind += nr; } diff --git a/lib/sh/zread.c b/lib/sh/zread.c index 8dd78102..71a06a76 100644 --- a/lib/sh/zread.c +++ b/lib/sh/zread.c @@ -1,6 +1,6 @@ /* zread - read data from file descriptor into buffer with retries */ -/* Copyright (C) 1999-2017 Free Software Foundation, Inc. +/* Copyright (C) 1999-2020 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -37,6 +37,10 @@ extern int errno; # define SEEK_CUR 1 #endif +#ifndef ZBUFSIZ +# define ZBUFSIZ 4096 +#endif + extern int executing_builtin; extern void check_signals_and_traps (void); @@ -117,7 +121,7 @@ zreadintr (fd, buf, len) in read(2). This does some local buffering to avoid many one-character calls to read(2), like those the `read' builtin performs. */ -static char lbuf[128]; +static char lbuf[ZBUFSIZ]; static size_t lind, lused; ssize_t