summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/command_lex.l2
-rw-r--r--lib/command_parse.y6
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/command_lex.l b/lib/command_lex.l
index 0a997de8df..47723cbf91 100644
--- a/lib/command_lex.l
+++ b/lib/command_lex.l
@@ -11,7 +11,7 @@ IPV6 X:X::X:X
IPV6_PREFIX X:X::X:X\/M
VARIABLE [A-Z][-_a-zA-Z:0-9]+
NUMBER [-|+]?[0-9]{1,20}
-RANGE \({NUMBER}\-{NUMBER}\)
+RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\)
/* yytext shall be a pointer */
%pointer
diff --git a/lib/command_parse.y b/lib/command_parse.y
index 9d7432ca40..0ea8744346 100644
--- a/lib/command_parse.y
+++ b/lib/command_parse.y
@@ -206,7 +206,11 @@ placeholder_token:
// get the numbers out
$$->min = strtoimax( yylval.string+1, &yylval.string, 10 );
- $$->max = strtoimax( yylval.string+1, &yylval.string, 10 );
+ strsep (&yylval.string, "-");
+ $$->max = strtoimax( yylval.string, &yylval.string, 10 );
+
+ // validate range
+ if ($$->min >= $$->max) yyerror("Invalid range.");
free ($1);
}