summaryrefslogtreecommitdiffstats
path: root/lib/command_lex.l
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-08-01 20:36:30 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-08-01 20:36:30 +0200
commite648e61a747c6c13ccea7d97066dfb07d4461d96 (patch)
tree69b027a83a6c1bbd41e1a5844a524a2b14c4bb22 /lib/command_lex.l
parentlib: Fixed bad node copy, modified token regex (diff)
downloadfrr-e648e61a747c6c13ccea7d97066dfb07d4461d96.tar.xz
frr-e648e61a747c6c13ccea7d97066dfb07d4461d96.zip
lib: Fix OOB range parses, variable matches
Variables now allow strings beginning with numbers to match, ranges and numbers are now long long to fix OOB parses resulting in integer wraparounds. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_lex.l')
-rw-r--r--lib/command_lex.l6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/command_lex.l b/lib/command_lex.l
index 9f47d96a8..ff951149b 100644
--- a/lib/command_lex.l
+++ b/lib/command_lex.l
@@ -28,7 +28,11 @@ RANGE \({NUMBER}\-{NUMBER}\)
{IPV6} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6;}
{IPV6_PREFIX} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return IPV6_PREFIX;}
{VARIABLE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return VARIABLE;}
-{NUMBER} {yylval.integer = atoi(yytext); return NUMBER;}
+{NUMBER} {
+ char *endptr;
+ yylval.integer = strtoll(yytext, &endptr, 10);
+ return NUMBER;
+ }
{RANGE} {yylval.string = XSTRDUP(MTYPE_TMP, yytext); return RANGE;}
. {return yytext[0];}
%%