Skip to contentSkip to conversation

evaluate: missing location for chain nested in table definition

PATCH In review Pablo Neira Ayuso 2 participants 2 messages Jul 22, 2019 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 evaluate: missing location for chain nested in table definition

error reporting may crash because location is unset.

---
This supersedes your patch 2/3. Regarding 1/3, I think it should be good to assume location must be always set, so BUG() is probably a good idea from erec_print() if unset.

 src/evaluate.c | 1 +
 1 file changed, 1 insertion(+)
src/evaluate.c +1 -0
index 69b853f58722..c6cc6ccad75d 100644
@@ -3516,6 +3516,7 @@ static int table_evaluate(struct eval_ctx *ctx, struct table *table)
 	}
 	list_for_each_entry(chain, &table->chains, list) {
 		handle_merge(&chain->handle, &table->handle);
+		ctx->cmd->handle.chain.location = chain->location;
 		if (chain_evaluate(ctx, chain) < 0)
 			return -1;
 	}
Signature · 1 line
2.11.0
maintainer
#1 lore raw
Quoted 7 lines · Pablo Neira Ayuso

error reporting may crash because location is unset.

---
This supersedes your patch 2/3. Regarding 1/3, I think it should be good to assume location must be always set, so BUG() is probably a good idea from erec_print() if unset.

I can confirm this works, instead of crash one now gets crash.nft:7:13-16: Error: No such file or directory

      chain test {
            ^^^^