summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2020-10-19 14:45:48 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2020-10-19 14:45:48 +0200
commit27362a5bfa4336476038cfe00a699f0b68a984aa (patch)
treedf49bf97896878e0a4a8ed2c361578fdfb8a1286 /src/rule.c
parent701e5dee5f53a131cd46d761f40db4c74ce3d33c (diff)
rule: larger number of error locations
Statically store up to 32 locations per command, if the number of locations is larger than 32, then skip rather than hit assertion. Revisit this later to dynamically store location per command using a hashtable. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rule.c b/src/rule.c
index 4719fd61..e57009b2 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -1475,7 +1475,9 @@ struct cmd *cmd_alloc(enum cmd_ops op, enum cmd_obj obj,
void cmd_add_loc(struct cmd *cmd, uint16_t offset, struct location *loc)
{
- assert(cmd->num_attrs < NFT_NLATTR_LOC_MAX);
+ if (cmd->num_attrs > NFT_NLATTR_LOC_MAX)
+ return;
+
cmd->attr[cmd->num_attrs].offset = offset;
cmd->attr[cmd->num_attrs].location = loc;
cmd->num_attrs++;