From owner-cvs-src@FreeBSD.ORG Sat Jun 14 23:26:09 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 340BA37B401; Sat, 14 Jun 2003 23:26:09 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D7FB043F93; Sat, 14 Jun 2003 23:26:08 -0700 (PDT) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h5F6Q80U072397; Sat, 14 Jun 2003 23:26:08 -0700 (PDT) (envelope-from rwatson@repoman.freebsd.org) Received: (from rwatson@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h5F6Q8li072396; Sat, 14 Jun 2003 23:26:08 -0700 (PDT) Message-Id: <200306150626.h5F6Q8li072396@repoman.freebsd.org> From: Robert Watson Date: Sat, 14 Jun 2003 23:26:08 -0700 (PDT) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sbin/sysctl sysctl.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jun 2003 06:26:09 -0000 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