about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2024-11-05 13:50:51 -0800
committerBart Schaefer <schaefer@zsh.org>2024-11-05 13:50:51 -0800
commitf282ff579284c7dd918438bc8e30fba4f6776c8c (patch)
treef0ef93322274279f263434bb6a951da12ec6c710
parentac1fd06d7ce073c86f00d50fd74464bcb5194e97 (diff)
downloadzsh-f282ff579284c7dd918438bc8e30fba4f6776c8c.tar.gz
zsh-f282ff579284c7dd918438bc8e30fba4f6776c8c.tar.xz
zsh-f282ff579284c7dd918438bc8e30fba4f6776c8c.zip
53209 + tests: do not unmetafy via string pointers into global parameter table
-rw-r--r--ChangeLog5
-rw-r--r--Src/params.c3
-rw-r--r--Test/D04parameter.ztst8
3 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 977e25159..35b01f95e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-11-05  Bart Schaefer  <schaefer@toltec-ubuntu>
+
+	* 53209 + comments + test: Src/params.c, Test/D04parameter.ztst:
+	do not unmetafy via string pointers into global parameter table
+
 2024-10-16  Bart Schaefer  <schaefer@toltec-ubuntu>
 
 	* 53146: Src/exec.c: trace flags cannot be copied from an
diff --git a/Src/params.c b/Src/params.c
index acd577527..6f137585b 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3064,8 +3064,9 @@ getsparam(char *s)
 mod_export char *
 getsparam_u(char *s)
 {
+    /* getsparam() returns pointer into global params table, so ... */
     if ((s = getsparam(s)))
-	return unmetafy(s, NULL);
+	return unmeta(s);	/* returns static pointer to copy */
     return s;
 }
 
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 0e2a04eb5..7953827d6 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -2834,3 +2834,11 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
   fi
 1:${(#X)...}: array of out-of-range characters
 ?(eval):4: character not in range
+
+  (
+   export ZDOTDIR=${ echo $PWD/'\0360\0237\0224\0256' }
+   $ZTST_testdir/../Src/zsh -c 'echo $ZDOTDIR'
+  )
+0:regression for workers/53179 unicode ZDOTDIR
+F:output ignorable as long as not an error
+*>*