From c8ee1a74909100709a9e88e68d4ff0c44e7b1397 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 28 May 2022 03:20:14 +0000 Subject: [PATCH] Do not walk off the end of the array performing frees crash found by daharmasterkor --- lib/libpcap/gencode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c index 572e48d1f7a..23fca891fc9 100644 --- a/lib/libpcap/gencode.c +++ b/lib/libpcap/gencode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gencode.c,v 1.61 2022/03/28 02:58:06 dlg Exp $ */ +/* $OpenBSD: gencode.c,v 1.62 2022/05/28 03:20:14 deraadt Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 @@ -207,7 +207,7 @@ freechunks(void) for (i = 0; i <= cur_membag; i++) { if (membag[i].ptrs == NULL) continue; - for (j = 0; j <= membag[i].slot; j++) + for (j = 0; j < membag[i].slot; j++) free(membag[i].ptrs[j]); free(membag[i].ptrs); membag[i].ptrs = NULL; -- 2.20.1