sbin/sysctl: Fix CTLFLAG_SKIP for adjacent nodes
The OID is saved when we encounter CTLFLAG_SKIP so that descendants can be skipped as well. We then must not update the skip OID until we are out of the node. This was achieved by resetting the skip OID once the prefix no longer matches, but the case where the OID we reset on has CTLFLAG_SKIP was not accounted for. Reported by: mav Reviewed by: mav MFC after: 2 days Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D28364
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user