From: Pablo Neira Ayuso Date: Fri, 7 Jun 2019 11:37:22 +0000 (+0200) Subject: libnftables: keep evaluating until parser_max_errors X-Git-Tag: v0.9.1~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df2f746fb4cfc68d178dcfcf1fe9db08bd56b660;p=thirdparty%2Fnftables.git libnftables: keep evaluating until parser_max_errors Bail out after parser_max_errors has been reached, eg. # nft -f /tmp/errors.nft /tmp/errors.nft:1:23-23: Error: syntax error, unexpected newline filter input tcp dport ^ /tmp/errors.nft:2:24-26: Error: datatype mismatch, expected internet network service, expression has type Internet protocol filter input tcp dport tcp ~~~~~~~~~ ^^^ /tmp/errors.nft:3:24-26: Error: datatype mismatch, expected internet network service, expression has type Internet protocol filter input tcp sport udp ~~~~~~~~~ ^^^ Fixes: f211921e25e6 ("src: perform evaluation after parsing") Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/libnftables.c b/src/libnftables.c index eae78e8b..e9dc03cf 100644 --- a/src/libnftables.c +++ b/src/libnftables.c @@ -393,7 +393,8 @@ static int nft_evaluate(struct nft_ctx *nft, struct list_head *msgs, .nft = nft, .msgs = msgs, }; - if (cmd_evaluate(&ectx, cmd) < 0) + if (cmd_evaluate(&ectx, cmd) < 0 && + ++nft->state->nerrs == nft->parser_max_errors) return -1; }