cvs commit: src/sbin/sysctl sysctl.c
Robert Watson
rwatson at FreeBSD.org
Sat Jun 14 23:26:09 PDT 2003
rwatson 2003/06/14 23:26:08 PDT
FreeBSD src repository
Modified files:
sbin/sysctl sysctl.c
Log:
Tighten up the string->integer conversion in sysctl(8):
(1) Reject zero-length strings for CTLTYPE_INT, _UINT, _LONG,
_ULONG. Do not silently convert to 0.
(2) When converting CTLTYPE_INT, _UINT, _LONG, and _ULONG, check the
end pointer generated by strtol() and strtoul() rather than
discarding it. Reject the string if either none of the string
was useful for conversion to an integer, or if there was
trailing garbage.
I.e., we will not allow you to set a numeric sysctl to a value unless
we can completely convert the string argument to a numeric value.
I tripped over this when I put the following in /etc/sysctl.conf:
kern.maxfiles="4000"
Ouch.
Revision Changes Path
1.53 +25 -5 src/sbin/sysctl/sysctl.c
More information about the cvs-src
mailing list