about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOrlov Sergey <orlov.home@gmail.com>2017-04-04 22:43:47 +0300
committerPeter Stephenson <pws@zsh.org>2017-04-10 09:55:06 +0100
commita11b241d4a5ec7ee1009905372cf32fb4538fbb3 (patch)
tree5c1c34534ddaf9766d1a5dd21113bc849ac56034
parentca2a43f23c626b3299404af4c7121777a3f142f7 (diff)
downloadzsh-a11b241d4a5ec7ee1009905372cf32fb4538fbb3.tar.gz
zsh-a11b241d4a5ec7ee1009905372cf32fb4538fbb3.tar.xz
zsh-a11b241d4a5ec7ee1009905372cf32fb4538fbb3.zip
40935: User names need metafying.
On some systems they can contain 8-bit characters and on all systems
this is logically correct anyway.
-rw-r--r--ChangeLog5
-rw-r--r--Src/utils.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b232c16af..828b7064f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-10  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* Orlov Sergey: 40935: Src/utils.c: User names need metafying as
+	they can contain multibyte characters on some systems.
+
 2017-04-07  Bart Schaefer  <schaefer@zsh.org>
 
 	* 40940: Src/cond.c: untokenize names of condition features
diff --git a/Src/utils.c b/Src/utils.c
index b3fa3d24c..9701ea78a 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1230,13 +1230,13 @@ adduserdir(char *s, char *t, int flags, int always)
 	 * named directory, since these are sometimes used for
 	 * special purposes.
 	 */
-	nd->dir = ztrdup(t);
+	nd->dir = metafy(t, -1, META_DUP);
     } else
-	nd->dir = ztrduppfx(t, eptr - t);
+	nd->dir = metafy(t, eptr - t, META_DUP);
     /* The variables PWD and OLDPWD are not to be displayed as ~PWD etc. */
     if (!strcmp(s, "PWD") || !strcmp(s, "OLDPWD"))
 	nd->node.flags |= ND_NOABBREV;
-    nameddirtab->addnode(nameddirtab, ztrdup(s), nd);
+    nameddirtab->addnode(nameddirtab, metafy(s, -1, META_DUP), nd);
 }
 
 /* Get a named directory: this function can cause a directory name *