diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-11-30 22:52:20 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-12-01 17:28:25 +0100 |
commit | 178bf85812ba426aba887157e0dbc5ab26b61561 (patch) | |
tree | d4c94b6bc64e84cb3efc4bf31da8aec2c4368ffb /src/scanner.l | |
parent | f77294ee03545141caf046df8c789ed494357627 (diff) |
scanner: don't bug on too large values
Add a new ERROR symbol to handle scanning of too large values.
<cmdline>:1:36-99: Error: bad value '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
add rule ip test-ip4 input ct mark 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
instead of:
BUG: nft: scanner.l:470: nft_lex: Assertion `0' failed.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/scanner.l')
-rw-r--r-- | src/scanner.l | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/scanner.l b/src/scanner.l index 2fafa71a..72b54471 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -459,16 +459,20 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) {decstring} { errno = 0; yylval->val = strtoull(yytext, NULL, 0); - if (errno != 0) - BUG(); + if (errno != 0) { + yylval->string = xstrdup(yytext); + return ERROR; + } return NUM; } {hexstring} { errno = 0; yylval->val = strtoull(yytext, NULL, 0); - if (errno != 0) - BUG(); + if (errno != 0) { + yylval->string = xstrdup(yytext); + return ERROR; + } return NUM; } |