summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-07-16 22:09:56 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-07-16 22:09:56 +0000
commitd4ba725ee514e47ae818c8e70f06e3dcc78d2949 (patch)
tree91b0cdbbe3e9752d8306319f38273222ff0c028c /sbin
parentffd59ddf4469ba6037d5ab47af6aefd9040d8048 (diff)
better flags parsing; dhartmei
Diffstat (limited to 'sbin')
-rw-r--r--sbin/pfctl/parse.y22
1 files changed, 18 insertions, 4 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index fc9bcd79f3f..20db6f327f6 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.1 2001/07/16 21:09:37 markus Exp $ */
+/* $OpenBSD: parse.y,v 1.2 2001/07/16 22:09:55 markus Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -290,10 +290,23 @@ port: NUMBER { $$ = htons($1); }
;
flags: { $$.b1 = 0; $$.b2 = 0; }
- | FLAGS STRING { $$.b1 = parse_flags($2); $$.b2 = 63; }
+ | FLAGS STRING {
+ int f;
+
+ if ((f = parse_flags($2)) < 0)
+ errx(1, "line %d: bad flags %s", lineno, $2);
+ $$.b1 = f;
+ $$.b2 = 63;
+ }
| FLAGS STRING "/" STRING {
- $$.b1 = parse_flags($2);
- $$.b2 = parse_flags($4);
+ int f;
+
+ if ((f = parse_flags($2)) < 0)
+ errx(1, "line %d: bad flags %s", lineno, $2);
+ $$.b1 = f;
+ if ((f = parse_flags($4)) < 0)
+ errx(1, "line %d: bad flags %s", lineno, $4);
+ $$.b2 = f;
}
;
@@ -605,6 +618,7 @@ yylex(void)
x != '>' && \
x != '!' && \
x != '=' && \
+ x != '/' && \
x != '#' )
if (isalnum(c)) {