aboutsummaryrefslogtreecommitdiff
path: root/sbin/sysctl
diff options
context:
space:
mode:
authorRyan Moeller <freqlabs@FreeBSD.org>2021-01-27 19:27:46 +0000
committerRyan Moeller <freqlabs@FreeBSD.org>2021-01-27 19:27:46 +0000
commit65efb73fbddd44116fd39b03991386a67422ba6d (patch)
treed5d4e8914549b37b319d704da5cc1834b6e7b562 /sbin/sysctl
parent48397f6c7d2d693602105d8ec24c5741202e264d (diff)
Diffstat (limited to 'sbin/sysctl')
-rw-r--r--sbin/sysctl/sysctl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index bd1e357065dc..30d6d94723fa 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1030,7 +1030,8 @@ show_var(int *oid, int nlen, bool honor_skip)
}
/* keep track of encountered skip nodes, ignoring descendants */
- if (skip_len == 0 && (kind & CTLFLAG_SKIP) != 0) {
+ if ((skip_len == 0 || skip_len >= nlen * (int)sizeof(int)) &&
+ (kind & CTLFLAG_SKIP) != 0) {
/* Save this oid so we can skip descendants. */
skip_len = nlen * sizeof(int);
memcpy(skip_oid, oid, skip_len);