summaryrefslogtreecommitdiff
path: root/usr.bin/compile_et/et_lex.lex.l
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/compile_et/et_lex.lex.l')
-rw-r--r--usr.bin/compile_et/et_lex.lex.l6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/compile_et/et_lex.lex.l b/usr.bin/compile_et/et_lex.lex.l
index 9f9e232375a..ae7fe547172 100644
--- a/usr.bin/compile_et/et_lex.lex.l
+++ b/usr.bin/compile_et/et_lex.lex.l
@@ -53,7 +53,6 @@
static unsigned lineno = 1;
void error_message(char *, ...);
int getstring(void);
-int yylex(void);
%}
@@ -91,7 +90,7 @@ getstring(void)
int i = 0;
int c;
int quote = 0;
- while((c = input()) != EOF){
+ while(i < sizeof(x) - 1 && (c = input()) != EOF){
if(quote) {
x[i++] = c;
quote = 0;
@@ -111,7 +110,8 @@ getstring(void)
x[i++] = c;
}
x[i] = '\0';
- yylval.string = strdup(x);
+ if ((yylval.string = strdup(x)) == NULL)
+ err(1, NULL);
return STRING;
}