From owner-freebsd-bugs Wed Nov 1 8:40: 9 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B6C0C37B4E5 for ; Wed, 1 Nov 2000 08:40:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id IAA98638; Wed, 1 Nov 2000 08:40:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 3D1C637B4C5; Wed, 1 Nov 2000 08:34:17 -0800 (PST) Message-Id: <20001101163417.3D1C637B4C5@hub.freebsd.org> Date: Wed, 1 Nov 2000 08:34:17 -0800 (PST) From: ryan.rempel@utoronto.ca To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/22482: The sysctl (8) command uses strtol on input for unsigned ints Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 22482 >Category: bin >Synopsis: The sysctl (8) command uses strtol on input for unsigned ints >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Nov 01 08:40:01 PST 2000 >Closed-Date: >Last-Modified: >Originator: Ryan Rempel >Release: None (well, Darwin) >Organization: >Environment: Not relevant, but here it is anyway. Darwin rempel.homeip.net 1.2 Darwin Kernel Version 1.2: Wed Aug 30 23:32:53 PDT 2000; root:xnu/xnu-103.obj~1/RELEASE_PPC Power Macintosh powerpc >Description: The freeBSD sysctl (8) command has been updated to display sysctl values as unsigned ints when the oid format is "IU". However, when using sysctl (8) to set sysctl values, strtol is used on the input, even for oids with format "IU". This means that values higher than 0x7FFFFFFF are clamped. >How-To-Repeat: Use sysctl to set an unsigned int value higher than 0x7FFFFFFF. For instance: sysctl -w kern.hostid=3456789012 >Fix: Here is a patch (I wrote) to sysctl (8) that fixes the problem. begin 644 sysctl.diff M26YD97@Z('-Y7-C=&PN8PDR,#`P+S$P+S(S(#(Q.C`T.C$X"3$N M,CD**RLK('-Y"@Q+"`B=6YK;F]W;B!O:60@)R5S)R(L M(&)U9G`I.PH@"BT):68@*&]I9&9M="AM:6(L(&QE;BP@,"P@)FMI;F0I*0HK M"6EF("AO:61F;70H;6EB+"!L96XL(&9M="P@)FMI;F0I*0H@"0EE