Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Oct 2010 21:20:56 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r214534 - head/bin/sh
Message-ID:  <201010292120.o9TLKuvX058661@svn.freebsd.org>

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



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