From owner-svn-src-all@FreeBSD.ORG Fri Oct 29 21:20:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1675106567A; Fri, 29 Oct 2010 21:20:56 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FD258FC0C; Fri, 29 Oct 2010 21:20:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9TLKuPs058663; Fri, 29 Oct 2010 21:20:56 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9TLKuvX058661; Fri, 29 Oct 2010 21:20:56 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010292120.o9TLKuvX058661@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 29 Oct 2010 21:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214534 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 21:20:56 -0000 Author: jilles Date: Fri Oct 29 21:20:56 2010 New Revision: 214534 URL: http://svn.freebsd.org/changeset/base/214534 Log: sh: Reject function names ending in one of !%*+-=?@}~ These do something else in ksh: name=(...) is an array or compound variable assignment and the others are extended patterns. This is the last patch of the ones tested in the exp run. Exp-run done by: pav (with some other sh(1) changes) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Fri Oct 29 21:20:14 2010 (r214533) +++ head/bin/sh/parser.c Fri Oct 29 21:20:56 2010 (r214534) @@ -644,9 +644,13 @@ simplecmd(union node **rpp, union node * /* * - Require plain text. * - Functions with '/' cannot be called. + * - Reject name=(). + * - Reject ksh extended glob patterns. */ if (!noexpand(n->narg.text) || quoteflag || - strchr(n->narg.text, '/')) + strchr(n->narg.text, '/') || + strchr("!%*+-=?@}~", + n->narg.text[strlen(n->narg.text) - 1])) synerror("Bad function name"); rmescapes(n->narg.text); if (find_builtin(n->narg.text, &special) >= 0 &&