mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-13 01:31:18 +02:00
23511: error if here document too large
This commit is contained in:
parent
4a1549e058
commit
023f6ce4e1
3 changed files with 22 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2007-06-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
|
* 23511: Src/exec.c, Src/lex.c: error if here document
|
||||||
|
too large.
|
||||||
|
|
||||||
2007-06-02 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
2007-06-02 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
* unposted: Functions/Calendar/age, Functions/Example/zls:
|
* unposted: Functions/Calendar/age, Functions/Example/zls:
|
||||||
|
|
|
@ -3111,7 +3111,13 @@ gethere(char *str, int typ)
|
||||||
;
|
;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (bptr == buf + bsiz) {
|
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);
|
t = buf + bsiz - (bptr - t);
|
||||||
bptr = buf + bsiz;
|
bptr = buf + bsiz;
|
||||||
bsiz *= 2;
|
bsiz *= 2;
|
||||||
|
|
10
Src/lex.c
10
Src/lex.c
|
@ -356,6 +356,16 @@ yylex(void)
|
||||||
ALLOWHIST
|
ALLOWHIST
|
||||||
cmdpop();
|
cmdpop();
|
||||||
hwend();
|
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);
|
setheredoc(hdocs->pc, REDIR_HERESTR, name);
|
||||||
zfree(hdocs, sizeof(struct heredocs));
|
zfree(hdocs, sizeof(struct heredocs));
|
||||||
hdocs = next;
|
hdocs = next;
|
||||||
|
|
Loading…
Reference in a new issue