mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 20:46:11 +02:00
[BUG] acl: fix handling of empty lines in pattern files
Gabriel Sosa reported that haproxy unexpectedly reports an error when a pattern file loaded by an ACL contains an empty line. The test was present but inefficient as it did not consider the '\n' as the end of the line. This fix relies on the line length instead. It should be backported to 1.4.
This commit is contained in:
parent
16023eef0b
commit
5109196275
@ -1083,15 +1083,16 @@ static int acl_read_patterns_from_file( struct acl_keyword *aclkw,
|
||||
while (*c == ' ' || *c == '\t')
|
||||
c++;
|
||||
|
||||
/* empty lines are ignored too */
|
||||
if (!*c)
|
||||
continue;
|
||||
|
||||
args[0] = c;
|
||||
while (*c && *c != '\n' && *c != '\r')
|
||||
c++;
|
||||
*c = 0;
|
||||
|
||||
/* empty lines are ignored too */
|
||||
if (c == args[0])
|
||||
continue;
|
||||
|
||||
/* we keep the previous pattern along iterations as long as it's not used */
|
||||
if (!pattern)
|
||||
pattern = (struct acl_pattern *)malloc(sizeof(*pattern));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user