Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F132024659
D2945.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D2945.diff
View Options
Index: head/lib/libc/gen/sysctl.c
===================================================================
--- head/lib/libc/gen/sysctl.c
+++ head/lib/libc/gen/sysctl.c
@@ -51,9 +51,21 @@
const void *newp, size_t newlen)
{
int retval;
+ size_t orig_oldlen;
+ orig_oldlen = oldlenp ? *oldlenp : 0;
retval = __sysctl(name, namelen, oldp, oldlenp, newp, newlen);
- if (retval != -1 || errno != ENOENT || name[0] != CTL_USER)
+ /*
+ * All valid names under CTL_USER have a dummy entry in the sysctl
+ * tree (to support name lookups and enumerations) with an
+ * empty/zero value, and the true value is supplied by this routine.
+ * For all such names, __sysctl() is used solely to validate the
+ * name.
+ *
+ * Return here unless there was a successful lookup for a CTL_USER
+ * name.
+ */
+ if (retval || name[0] != CTL_USER)
return (retval);
if (newp != NULL) {
@@ -67,7 +79,7 @@
switch (name[1]) {
case USER_CS_PATH:
- if (oldp && *oldlenp < sizeof(_PATH_STDPATH)) {
+ if (oldp && orig_oldlen < sizeof(_PATH_STDPATH)) {
errno = ENOMEM;
return -1;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 14, 1:19 AM (29 m, 18 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23700299
Default Alt Text
D2945.diff (1 KB)
Attached To
Mode
D2945: Fix handling of 'user' mib in sysctl(3)
Attached
Detach File
Event Timeline
Log In to Comment