Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Jun 2003 23:26:08 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sbin/sysctl sysctl.c
Message-ID:  <200306150626.h5F6Q8li072396@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306150626.h5F6Q8li072396>