Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Nov 2012 13:50:52 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r243402 - stable/9/bin/sh
Message-ID:  <201211221350.qAMDoqxw090693@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Thu Nov 22 13:50:51 2012
New Revision: 243402
URL: http://svnweb.freebsd.org/changeset/base/243402

Log:
  MFC r242766: sh: Fix two issues when an alias is redefined:
  
   * The last character is not displayed.
   * If the alias ends with itself (as a word), an infinite memory-eating loop
     occurs.
  
  If an alias is defined initially, a space is appended to avoid recursion but
  this did not happen when an alias was later modified.
  
  PR:		bin/173418
  Submitted by:	Daniel F.

Modified:
  stable/9/bin/sh/alias.c
Directory Properties:
  stable/9/bin/sh/   (props changed)

Modified: stable/9/bin/sh/alias.c
==============================================================================
--- stable/9/bin/sh/alias.c	Thu Nov 22 12:11:32 2012	(r243401)
+++ stable/9/bin/sh/alias.c	Thu Nov 22 13:50:51 2012	(r243402)
@@ -68,7 +68,18 @@ setalias(const char *name, const char *v
 		if (equal(name, ap->name)) {
 			INTOFF;
 			ckfree(ap->val);
+			/* See HACK below. */
+#ifdef notyet
 			ap->val	= savestr(val);
+#else
+			{
+			size_t len = strlen(val);
+			ap->val = ckmalloc(len + 2);
+			memcpy(ap->val, val, len);
+			ap->val[len] = ' ';
+			ap->val[len+1] = '\0';
+			}
+#endif
 			INTON;
 			return;
 		}



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