git: 2877241e2643 - stable/14 - ipfw: fix off-by-one error in bdel()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Nov 2026 07:07:10 UTC
The branch stable/14 has been updated by ae:
URL: https://cgit.FreeBSD.org/src/commit/?id=2877241e264321b3ab7f86330c30a23f5ffa8eb0
commit 2877241e264321b3ab7f86330c30a23f5ffa8eb0
Author: Andrey V. Elsukov <ae@FreeBSD.org>
AuthorDate: 2026-10-28 11:13:53 +0000
Commit: Andrey V. Elsukov <ae@FreeBSD.org>
CommitDate: 2026-11-05 07:06:46 +0000
ipfw: fix off-by-one error in bdel()
After deleting an item from a sorted array, bdel() moves the tail
following it, but the size of the data to move was calculated with
an off-by-one error, causing memmove() to read one element past the
end of the array. This can happen when the table is full for ifidx
or numarray algorithms.
Obtained from: Yandex LLC
Sponsored by: Yandex LLC
(cherry picked from commit c6b08de0e4c797929f4609d86395d494ac695c68)
---
sys/netpfil/ipfw/ip_fw_table_algo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/netpfil/ipfw/ip_fw_table_algo.c b/sys/netpfil/ipfw/ip_fw_table_algo.c
index ccc1a8098585..9a48edb2e1ae 100644
--- a/sys/netpfil/ipfw/ip_fw_table_algo.c
+++ b/sys/netpfil/ipfw/ip_fw_table_algo.c
@@ -2061,7 +2061,7 @@ bdel(const void *key, void *base, size_t nmemb, size_t size,
if (item == NULL)
return (0);
- sz = (caddr_t)base + nmemb * size - item;
+ sz = (caddr_t)base + nmemb * size - item - size;
if (sz > 0)
memmove(item, item + size, sz);