mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-19 02:29:40 +00:00
pfctl: improve error reporting for routehost
If an invalid (i.e. overly long) interface name is specified error out
immediately, rather than in expand_rule() so we point at the incorrect
line.
PR: 260958
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D34008
(cherry picked from commit e68de66943
)
This commit is contained in:
parent
1e261cb8c6
commit
b5f6f687a2
@ -4544,6 +4544,10 @@ route_host : STRING {
|
||||
$$ = calloc(1, sizeof(struct node_host));
|
||||
if ($$ == NULL)
|
||||
err(1, "route_host: calloc");
|
||||
if (strlen($1) >= IFNAMSIZ) {
|
||||
yyerror("interface name too long");
|
||||
YYERROR;
|
||||
}
|
||||
$$->ifname = strdup($1);
|
||||
set_ipmask($$, 128);
|
||||
$$->next = NULL;
|
||||
@ -4553,8 +4557,13 @@ route_host : STRING {
|
||||
struct node_host *n;
|
||||
|
||||
$$ = $3;
|
||||
for (n = $3; n != NULL; n = n->next)
|
||||
for (n = $3; n != NULL; n = n->next) {
|
||||
if (strlen($2) >= IFNAMSIZ) {
|
||||
yyerror("interface name too long");
|
||||
YYERROR;
|
||||
}
|
||||
n->ifname = strdup($2);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user