about summary refs log tree commit diff
path: root/users/multi/pkgs/htop/zfs-arc-stats/0001-Specify-correct-MIB-length.patch
diff options
context:
space:
mode:
Diffstat (limited to 'users/multi/pkgs/htop/zfs-arc-stats/0001-Specify-correct-MIB-length.patch')
-rw-r--r--users/multi/pkgs/htop/zfs-arc-stats/0001-Specify-correct-MIB-length.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/users/multi/pkgs/htop/zfs-arc-stats/0001-Specify-correct-MIB-length.patch b/users/multi/pkgs/htop/zfs-arc-stats/0001-Specify-correct-MIB-length.patch
new file mode 100644
index 000000000000..5bd4d5edfa5b
--- /dev/null
+++ b/users/multi/pkgs/htop/zfs-arc-stats/0001-Specify-correct-MIB-length.patch
@@ -0,0 +1,27 @@
+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
+