Skip to content

Commit

Permalink
jail: make sure jail.conf parse errors exit, and not crash.
Browse files Browse the repository at this point in the history
Reported by:	Mason Loring Bliss
  • Loading branch information
Jamie Gritton authored and Jamie Gritton committed Jan 21, 2024
1 parent deeb1d3 commit 768149f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions usr.sbin/jail/jailparse.y
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,19 @@ extern int YYLEX_DECL();
static void
YYERROR_DECL()
{
struct cflex *cflex = yyget_extra(scanner);

if (!yyget_text(scanner))
warnx("%s line %d: %s",
yyget_extra(scanner)->cfname, yyget_lineno(scanner), s);
cflex->cfname, yyget_lineno(scanner), s);
else if (!yyget_text(scanner)[0])
warnx("%s: unexpected EOF",
yyget_extra(scanner)->cfname);
cflex->cfname);
else
warnx("%s line %d: %s: %s",
yyget_extra(scanner)->cfname, yyget_lineno(scanner),
cflex->cfname, yyget_lineno(scanner),
yyget_text(scanner), s);
cflex->error = 1;
}

/* Handle special parameters (i.e. the include directive).
Expand Down

0 comments on commit 768149f

Please sign in to comment.