diff options
author | Eric Leblond <eric@regit.org> | 2014-11-29 17:24:38 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-12-01 17:27:51 +0100 |
commit | bbcfefc7d3fdebae0685b4ddf65a35567c59464b (patch) | |
tree | 7916c4a2cbc25faf374f4c1e1c7d0b3fd1352a76 /src/scanner.l | |
parent | b848ff5de4e974dd9e471fc0888ea990a86e34af (diff) |
scanner: fix reading of really long line
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/scanner.l')
-rw-r--r-- | src/scanner.l | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/scanner.l b/src/scanner.l index f0ed8d4e..2fafa71a 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); \ |