commit bash-20200622 snapshot

This commit is contained in:
Chet Ramey
2020-06-23 19:10:52 -04:00
parent bdf37a2d4f
commit 6edcd70089
4 changed files with 30 additions and 6 deletions
+12
View File
@@ -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 <Jason@zx2c4.com>
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)
+5 -1
View File
@@ -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)
+7 -3
View File
@@ -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;
}
+6 -2
View File
@@ -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