summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-05-14 09:28:57 +0100
committerPeter Stephenson <pws@zsh.org>2015-05-14 09:28:57 +0100
commit85a4cf9b36fe7cf876266a49950e80d00ca4c18f (patch)
tree80217473b19dfd996fba3702a1e2327791eecd50 /Src
parent08fb0f6602d928414f49c316ca1ace5b8f36070a (diff)
downloadzsh-85a4cf9b36fe7cf876266a49950e80d00ca4c18f.tar.gz
zsh-85a4cf9b36fe7cf876266a49950e80d00ca4c18f.tar.xz
zsh-85a4cf9b36fe7cf876266a49950e80d00ca4c18f.zip
35110: don't implicitly initialize restricted integers to zero
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 70e75ff17..18dad7491 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2344,7 +2344,12 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 	    pm->gsu.s->setfn(pm, ztrdup(""));
 	    break;
 	case PM_INTEGER:
-	    pm->gsu.i->setfn(pm, 0);
+	    /*
+	     * Restricted integers are dangerous to initialize to 0,
+	     * so don't do that.
+	     */
+	    if (!(pm->old->node.flags & PM_RESTRICTED))
+		pm->gsu.i->setfn(pm, 0);
 	    break;
 	case PM_EFLOAT:
 	case PM_FFLOAT: