1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-03 10:21:46 +02:00

43156, 43157: Need to allow for extra space in gethere().

The point can now increment twice per iteration.
This commit is contained in:
Peter Stephenson 2018-07-10 14:42:02 +01:00
parent 17178db1a4
commit 3e9fc32fc3
2 changed files with 10 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2018-07-10 Peter Stephenson <p.stephenson@samsung.com>
* 43156, 43157: Src/exec.c: need to allow for possible
update of pointer by two in gethere().
2018-07-09 Peter Stephenson <p.stephenson@samsung.com>
* users/23531: Src/exec.c, Test/C03traps.ztst: Fix error

View file

@ -4418,7 +4418,9 @@ gethere(char **strp, int typ)
while ((c = hgetc()) == '\t' && strip)
;
for (;;) {
if (bptr == buf + bsiz) {
if (bptr >= buf + bsiz - 2) {
ptrdiff_t toff = t - buf;
ptrdiff_t bptroff = bptr - buf;
char *newbuf = realloc(buf, 2 * bsiz);
if (!newbuf) {
/* out of memory */
@ -4426,8 +4428,8 @@ gethere(char **strp, int typ)
return NULL;
}
buf = newbuf;
t = buf + bsiz - (bptr - t);
bptr = buf + bsiz;
t = buf + toff;
bptr = buf + bptroff;
bsiz *= 2;
}
if (lexstop || c == '\n')