diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-08-01 20:36:30 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-08-01 20:36:30 +0200 |
commit | e648e61a747c6c13ccea7d97066dfb07d4461d96 (patch) | |
tree | 69b027a83a6c1bbd41e1a5844a524a2b14c4bb22 /lib/command_lex.l | |
parent | lib: Fixed bad node copy, modified token regex (diff) | |
download | frr-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.l | 6 |
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];} %% |