From 931737a1719824d7945433177e61a6c47530ed69 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 6 Dec 2022 22:59:55 +0100 Subject: scanner: munch full comment lines Munch lines full comment lines, regular expression matches lines that start by space or tab, then # follows, finally anything including one single line break. Call reset_pos() to ensure error reporting location is not puzzled. Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1196 Signed-off-by: Pablo Neira Ayuso --- src/scanner.l | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/scanner.l b/src/scanner.l index 1371cd04..e72a427a 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -124,6 +124,7 @@ string ({letter}|[_.])({letter}|{digit}|[/\-_\.])* quotedstring \"[^"]*\" asteriskstring ({string}\*|{string}\\\*|\\\*|{string}\\\*{string}) comment #.*$ +comment_line ^[ \t]*#.*\n slash \/ timestring ([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s)?([0-9]+ms)? @@ -858,6 +859,9 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) {tab}+ {space}+ {comment} +{comment_line} { + reset_pos(yyget_extra(yyscanner), yylloc); + } <> { update_pos(yyget_extra(yyscanner), yylloc, 1); -- cgit v1.2.3