From owner-svn-src-stable@freebsd.org Wed Jun 20 06:24:04 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 144451003C48; Wed, 20 Jun 2018 06:24:04 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BADDC6A2A4; Wed, 20 Jun 2018 06:24:03 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BB641E94B; Wed, 20 Jun 2018 06:24:03 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5K6O3wS015063; Wed, 20 Jun 2018 06:24:03 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5K6O318015062; Wed, 20 Jun 2018 06:24:03 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201806200624.w5K6O318015062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Wed, 20 Jun 2018 06:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r335409 - stable/11/usr.sbin/sysrc X-SVN-Group: stable-11 X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: stable/11/usr.sbin/sysrc X-SVN-Commit-Revision: 335409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2018 06:24:04 -0000 Author: dteske Date: Wed Jun 20 06:24:03 2018 New Revision: 335409 URL: https://svnweb.freebsd.org/changeset/base/335409 Log: MFC r334303: sysrc(8): Test variable names for invalid characters PR: bin/187461 Reported by: ebay@looksharp.net Sponsored by: Smule, Inc. Modified: stable/11/usr.sbin/sysrc/sysrc Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/sysrc/sysrc ============================================================================== --- stable/11/usr.sbin/sysrc/sysrc Wed Jun 20 06:11:51 2018 (r335408) +++ stable/11/usr.sbin/sysrc/sysrc Wed Jun 20 06:24:03 2018 (r335409) @@ -370,6 +370,18 @@ if [ "$LIST_SERVICE_CONFS" ]; then fi # +# Validate arguments +# +for name in "$@"; do + # NB: shell expansion syntax removed first + name="${name%%:[+=-]*}" + name="${name%%[%#+=-]*}" + [ "$name" = "${name#*[!$VALID_VARNAME_CHARS]}" ] || die \ + "%s: %s: name contains characters not allowed in shell" \ + "$pgm" "$name" +done + +# # Process `-s name' argument # if [ "$SERVICE" -a ! "${RC_CONFS+set}" ]; then