From 023f6ce4e19331c3658c58955e178ca92783c5a1 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 3 Jun 2007 17:44:20 +0000 Subject: 23511: error if here document too large --- Src/exec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Src/exec.c') diff --git a/Src/exec.c b/Src/exec.c index ccba66bf8..7e4b55d43 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -3111,7 +3111,13 @@ gethere(char *str, int typ) ; for (;;) { if (bptr == buf + bsiz) { - buf = realloc(buf, 2 * bsiz); + char *newbuf = realloc(buf, 2 * bsiz); + if (!newbuf) { + /* out of memory */ + zfree(buf, bsiz); + return NULL; + } + buf = newbuf; t = buf + bsiz - (bptr - t); bptr = buf + bsiz; bsiz *= 2; -- cgit v1.2.3