diff options
author | Phil Sutter <phil@nwl.cc> | 2021-06-11 17:08:34 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-06-14 13:31:07 +0200 |
commit | 2d0a7a9adeb30708d6fbbee57476c0d4b9214dbd (patch) | |
tree | fdeba77a3382fe47803a5f6cebb436cf8551b673 /src/rule.c | |
parent | c4058f96c6a55e4fcd49d4380ac07b5466ec01c0 (diff) |
rule: Fix for potential off-by-one in cmd_add_loc()
Using num_attrs as index means it must be at max one less than the
array's size at function start.
Fixes: 27362a5bfa433 ("rule: larger number of error locations")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/rule.c')
-rw-r--r-- | src/rule.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1275,7 +1275,7 @@ struct cmd *cmd_alloc(enum cmd_ops op, enum cmd_obj obj, void cmd_add_loc(struct cmd *cmd, uint16_t offset, const struct location *loc) { - if (cmd->num_attrs > NFT_NLATTR_LOC_MAX) + if (cmd->num_attrs >= NFT_NLATTR_LOC_MAX) return; cmd->attr[cmd->num_attrs].offset = offset; |