From: deraadt Date: Sat, 28 May 2022 03:20:14 +0000 (+0000) Subject: Do not walk off the end of the array performing frees X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c8ee1a74909100709a9e88e68d4ff0c44e7b1397;p=openbsd Do not walk off the end of the array performing frees crash found by daharmasterkor --- 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;