diff options
author | Jamie Gritton <jamie@FreeBSD.org> | 2024-01-21 05:20:59 +0000 |
---|---|---|
committer | Jamie Gritton <jamie@FreeBSD.org> | 2024-02-02 16:44:20 +0000 |
commit | dcae9657814544c4ac2c28bec0022346eb7c587f (patch) | |
tree | 8377dc7afd339e22dc23e4f584066087ba9859f3 | |
parent | 73ef676c9ffd625027fa7fd0ccb9948adae00d93 (diff) | |
download | src-dcae9657814544c4ac2c28bec0022346eb7c587f.tar.gz src-dcae9657814544c4ac2c28bec0022346eb7c587f.zip |
MFC jail: make sure jail.conf parse errors exit, and not crash.
Reported by: Mason Loring Bliss
(cherry picked from commit 768149ff156e7d34a035853030bf946ca94cb461)
-rw-r--r-- | usr.sbin/jail/jailparse.y | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/jail/jailparse.y b/usr.sbin/jail/jailparse.y index 047ca882e59f..048cfcf11c2b 100644 --- a/usr.sbin/jail/jailparse.y +++ b/usr.sbin/jail/jailparse.y @@ -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). |