tvl-depot/users/multi/pkgs/htop/zfs-arc-stats/0001-Specify-correct-MIB-length.patch
multi 5851f672ac feat(users/multi): bootstrap home-manager configuration for whitby
Change-Id: Iad3024a5a640d33377cfae436134fda9f358397b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1703
Tested-by: BuildkiteCI
Reviewed-by: multi <depot@in-addr.xyz>
2020-08-10 16:37:46 +00:00

27 lines
1.1 KiB
Diff

From 92258e99e639795f4119a86a1c44d5015b29ffdc Mon Sep 17 00:00:00 2001
From: Ross Williams <ross@ross-williams.net>
Date: Sat, 6 Jul 2019 04:27:00 +0000
Subject: [PATCH 1/9] Specify correct MIB length
Could have resulted in a buffer overflow if the
FreeBSD kernel returned more bytes than expected.
---
freebsd/FreeBSDProcessList.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c
index 9fef324..26019b6 100644
--- a/freebsd/FreeBSDProcessList.c
+++ b/freebsd/FreeBSDProcessList.c
@@ -121,7 +121,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
len = sizeof(fpl->memZfsArc);
if (sysctlbyname("kstat.zfs.misc.arcstats.size", &fpl->memZfsArc, &len,
NULL, 0) == 0 && fpl->memZfsArc != 0) {
- sysctlnametomib("kstat.zfs.misc.arcstats.size", MIB_kstat_zfs_misc_arcstats_size, &len);
+ len = 5; sysctlnametomib("kstat.zfs.misc.arcstats.size", MIB_kstat_zfs_misc_arcstats_size, &len);
fpl->zfsArcEnabled = 1;
} else {
fpl->zfsArcEnabled = 0;
--
2.20.1