Changeset View
Changeset View
Standalone View
Standalone View
sbin/sysctl/sysctl.c
Show First 20 Lines • Show All 1,024 Lines • ▼ Show 20 Lines | if (tflag || dflag) { | ||||
qoid[1] = CTL_SYSCTL_OIDDESCR; | qoid[1] = CTL_SYSCTL_OIDDESCR; | ||||
j = sizeof(buf); | j = sizeof(buf); | ||||
i = sysctl(qoid, nlen + 2, buf, &j, 0, 0); | i = sysctl(qoid, nlen + 2, buf, &j, 0, 0); | ||||
printf("%s", buf); | printf("%s", buf); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* keep track of encountered skip nodes, ignoring descendants */ | /* 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. */ | /* Save this oid so we can skip descendants. */ | ||||
skip_len = nlen * sizeof(int); | skip_len = nlen * sizeof(int); | ||||
memcpy(skip_oid, oid, skip_len); | memcpy(skip_oid, oid, skip_len); | ||||
} | } | ||||
/* bail before fetching the value if we're honoring skip */ | /* bail before fetching the value if we're honoring skip */ | ||||
if (honor_skip) { | if (honor_skip) { | ||||
if (0 < skip_len && skip_len <= nlen * (int)sizeof(int) && | if (0 < skip_len && skip_len <= nlen * (int)sizeof(int) && | ||||
▲ Show 20 Lines • Show All 226 Lines • Show Last 20 Lines |