From: Eric Leblond <eric@regit.org>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org, Eric Leblond <eric@regit.org>
Subject: [nft PATCH] scanner: fix reading of really long line
Date: Sat, 29 Nov 2014 17:24:38 +0100 [thread overview]
Message-ID: <1417278278-30206-1-git-send-email-eric@regit.org> (raw)
Current code is causing a failure in adding a set containing
a really long list of elements. The failure occurs as soon as
the line is longer than flex read buffer.
When a line is longer than scanner buffer size, the code in YY_INPUT
forces a rewind to the beginning of the string because it does not
find a end of line. The result is that the string is never parsed.
This patch updates the code by rewinding till we found a space.
Signed-off-by: Eric Leblond <eric@regit.org>
---
src/scanner.l | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/scanner.l b/src/scanner.l
index f0ed8d4..2fafa71 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -47,7 +47,8 @@
clearerr(yyin); \
} \
if (result > 1) { \
- while (result > 1 && buf[result - 1] != '\n') \
+ while (result > 1 && \
+ (buf[result - 1] != '\n' && buf[result - 1] != ' ')) \
result--, n++; \
result--, n++; \
fseek(yyin, -n, SEEK_CUR); \
--
2.1.3
next reply other threads:[~2014-11-29 16:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-29 16:24 Eric Leblond [this message]
2014-12-01 11:55 ` [nft PATCH] scanner: fix reading of really long line Pablo Neira Ayuso
-- strict thread matches above, loose matches on Subject: below --
2014-12-01 13:46 Eric Leblond
2014-12-03 11:53 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1417278278-30206-1-git-send-email-eric@regit.org \
--to=eric@regit.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).