1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-31 18:10:56 +01:00

23511: error if here document too large

This commit is contained in:
Peter Stephenson 2007-06-03 17:44:20 +00:00
parent 4a1549e058
commit 023f6ce4e1
3 changed files with 22 additions and 1 deletions

View file

@ -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;

View file

@ -356,6 +356,16 @@ yylex(void)
ALLOWHIST
cmdpop();
hwend();
if (!name) {
zerr("here document too large");
while (hdocs) {
next = hdocs->next;
zfree(hdocs, sizeof(struct heredocs));
hdocs = next;
}
tok = LEXERR;
break;
}
setheredoc(hdocs->pc, REDIR_HERESTR, name);
zfree(hdocs, sizeof(struct heredocs));
hdocs = next;