Blame SOURCES/0013-rule-Fix-for-potential-off-by-one-in-cmd_add_loc.patch

195495
From 5fbf4169fba1dfef0f461c4fe31bed70610ebce2 Mon Sep 17 00:00:00 2001
195495
From: Phil Sutter <phil@nwl.cc>
195495
Date: Fri, 11 Jun 2021 17:08:34 +0200
195495
Subject: [PATCH] rule: Fix for potential off-by-one in cmd_add_loc()
195495
195495
Using num_attrs as index means it must be at max one less than the
195495
array's size at function start.
195495
195495
Fixes: 27362a5bfa433 ("rule: larger number of error locations")
195495
Signed-off-by: Phil Sutter <phil@nwl.cc>
195495
(cherry picked from commit 2d0a7a9adeb30708d6fbbee57476c0d4b9214dbd)
195495
Signed-off-by: Phil Sutter <psutter@redhat.com>
195495
---
195495
 src/rule.c | 2 +-
195495
 1 file changed, 1 insertion(+), 1 deletion(-)
195495
195495
diff --git a/src/rule.c b/src/rule.c
195495
index e4bb6bae276a0..03422da3a7560 100644
195495
--- a/src/rule.c
195495
+++ b/src/rule.c
195495
@@ -1491,7 +1491,7 @@ struct cmd *cmd_alloc(enum cmd_ops op, enum cmd_obj obj,
195495
 
195495
 void cmd_add_loc(struct cmd *cmd, uint16_t offset, const struct location *loc)
195495
 {
195495
-	if (cmd->num_attrs > NFT_NLATTR_LOC_MAX)
195495
+	if (cmd->num_attrs >= NFT_NLATTR_LOC_MAX)
195495
 		return;
195495
 
195495
 	cmd->attr[cmd->num_attrs].offset = offset;
195495
-- 
195495
2.31.1
195495