The branch stable/14 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=9b4b68e82739e7f5e0ea337abffd0cadcb9abc8b
commit 9b4b68e82739e7f5e0ea337abffd0cadcb9abc8b Author: Andrey V. Elsukov <[email protected]> AuthorDate: 2026-09-22 07:21:52 +0000 Commit: Andrey V. Elsukov <[email protected]> CommitDate: 2026-09-22 07:21:52 +0000 ipfw: fix gcc warning We use first loop only for possible needed realloc, so it is not required to restrict end condition. Also check realloc() return value before accessing. This is direct commit to stable/14. Reported by: dim Differential Revision: https://reviews.freebsd.org/D56616 --- sbin/ipfw/ipfw2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index a8a70dccf125..99a94a1b9d1d 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -5883,12 +5883,12 @@ ipfw_detect_u32_kbi(void) need = sizeof(ipfw_obj_lheader) + (64 * sizeof(ipfw_sopt_info)); opver = 0; - for (i = 4; i >= 0; i--) { + for (i = 5; i > 0; i--) { hdr = realloc(hdr, need); - memset(hdr, 0, need); if (hdr == NULL) break; + memset(hdr, 0, need); hdr->opheader.opcode = IP_FW_DUMP_SOPTCODES; hdr->opheader.version = opver; hdr->size = need;
