From bbcfefc7d3fdebae0685b4ddf65a35567c59464b Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Sat, 29 Nov 2014 17:24:38 +0100 Subject: 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 Signed-off-by: Pablo Neira Ayuso --- src/scanner.l | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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); \ -- cgit v1.2.3