git: dcae96578145 - stable/14 - MFC jail: make sure jail.conf parse errors exit, and not crash. Reported by: Mason Loring Bliss
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 02 Feb 2024 16:45:44 UTC
The branch stable/14 has been updated by jamie:
URL: https://cgit.FreeBSD.org/src/commit/?id=dcae9657814544c4ac2c28bec0022346eb7c587f
commit dcae9657814544c4ac2c28bec0022346eb7c587f
Author: Jamie Gritton <jamie@FreeBSD.org>
AuthorDate: 2024-01-21 05:20:59 +0000
Commit: Jamie Gritton <jamie@FreeBSD.org>
CommitDate: 2024-02-02 16:44:20 +0000
MFC jail: make sure jail.conf parse errors exit, and not crash.
Reported by: Mason Loring Bliss
(cherry picked from commit 768149ff156e7d34a035853030bf946ca94cb461)
---
usr.sbin/jail/jailparse.y | 9 ++++++---
1 file 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).