git: 3bcfea696902 - stable/15 - ipfw: fix off-by-one error in bdel()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 05 Nov 2026 07:05:38 UTC
The branch stable/15 has been updated by ae:
URL: https://cgit.FreeBSD.org/src/commit/?id=3bcfea6969029f67e788e31e2dfc58c43de089c5
commit 3bcfea6969029f67e788e31e2dfc58c43de089c5
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:05:02 +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 515c420ed663..23642c657227 100644
--- a/sys/netpfil/ipfw/ip_fw_table_algo.c
+++ b/sys/netpfil/ipfw/ip_fw_table_algo.c
@@ -2063,7 +2063,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);