about summary refs log tree commit diff
path: root/users/multi/pkgs/htop/zfs-arc-stats/0001-Specify-correct-MIB-length.patch
blob: 5bd4d5edfa5ba1343da145a008dfe9a4819785f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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