about summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 818ea9f8e..22e05dbb0 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -480,7 +480,10 @@ add(int c)
 	bsiz = newbsiz;
 #endif
 
-	int newbsiz = bsiz + 32;
+	int newbsiz = bsiz * 2;
+
+	if (newbsiz > inbufct && inbufct > bsiz)
+	    newbsiz = inbufct;
 
 	bptr = len + (tokstr = (char *)hrealloc(tokstr, bsiz, newbsiz));
 	bsiz = newbsiz;