tcsh/tcsh-6.22.02-avoid-crashing...

48 lines
1.2 KiB
Diff

From 7d25c5d5ad5e9c0cd17a21f73aeb2374a29ecd83 Mon Sep 17 00:00:00 2001
From: zoulasc <christos@zoulas.com>
Date: Fri, 31 Jul 2020 14:30:40 -0400
Subject: [PATCH] Switch to stderror() when parsing history so that we stop
processing immediately (Jan Macku)
---
sh.lex.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sh.lex.c b/sh.lex.c
index ecab059..d83ffa0 100644
--- a/sh.lex.c
+++ b/sh.lex.c
@@ -183,8 +183,7 @@ lex(struct wordent *hp)
wdp->word = word(parsehtime);
parsehtime = 0;
if (enterhist && toolong++ > 10 * 1024) {
- seterror(ERR_LTOOLONG);
- break;
+ stderror(ERR_LTOOLONG);
}
} while (wdp->word[0] != '\n');
cleanup_ignore(hp);
@@ -303,8 +302,7 @@ word(int parsehtime)
cleanup_push(&wbuf, Strbuf_cleanup);
loop:
if (enterhist && toolong++ > 256 * 1024) {
- seterror(ERR_WTOOLONG);
- goto ret;
+ stderror(ERR_WTOOLONG);
}
while ((c = getC(DOALL)) == ' ' || c == '\t')
continue;
@@ -365,8 +363,7 @@ loop:
dolflg = DOALL;
for (;;) {
if (enterhist && toolong++ > 256 * 1024) {
- seterror(ERR_WTOOLONG);
- goto ret;
+ stderror(ERR_WTOOLONG);
}
if (c1) {
if (c == c1) {
--
2.25.4