summary refs log tree commit diff
path: root/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/parse.c b/parse.c
index 37e387a..07b35e9 100644
--- a/parse.c
+++ b/parse.c
@@ -246,7 +246,7 @@ lex()
 		t = TTyp;
 		goto Alpha;
 	case '#':
-		while (fgetc(inf) != '\n')
+		while ((c=fgetc(inf)) != '\n' && c != EOF)
 			;
 	case '\n':
 		lnum++;
@@ -262,6 +262,8 @@ lex()
 		tokval.str = vnew(0, 1);
 		for (i=0;; i++) {
 			c = fgetc(inf);
+			if (c == EOF)
+				err("unterminated string");
 			vgrow(&tokval.str, i+1);
 			if (c == '"')
 			if (!i || tokval.str[i-1] != '\\') {