diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2002-09-19 17:51:45 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2002-09-19 17:51:45 +0000 |
commit | ebe8fe6d9184d432c56ea5fff79af2e0f3f516de (patch) | |
tree | 421b249afe5a1bf3c85be9d4938fae98176513cc /Src/builtin.c | |
parent | 9a8a7cf3acdbe3bdc8efdc5b91836a472b894bf9 (diff) | |
download | zsh-ebe8fe6d9184d432c56ea5fff79af2e0f3f516de.tar.gz zsh-ebe8fe6d9184d432c56ea5fff79af2e0f3f516de.tar.xz zsh-ebe8fe6d9184d432c56ea5fff79af2e0f3f516de.zip |
17692: Prevent typeset of a positional parameter before it can do damage,
and improve the error message about it.
Diffstat (limited to 'Src/builtin.c')
-rw-r--r-- | Src/builtin.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index c43751711..dd553cf1c 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -1825,7 +1825,7 @@ typeset_single(char *cname, char *pname, Param pm, int func, "%s: array elements must be scalar", pname, 0); return NULL; } - } else if (isident(pname)) { + } else if (isident(pname) && !idigit(*pname)) { /* * Create a new node for a parameter with the flags in `on' minus the * readonly flag @@ -1834,7 +1834,10 @@ typeset_single(char *cname, char *pname, Param pm, int func, DPUTS(!pm, "BUG: parameter not created"); pm->ct = auxlen; } else { - zerr("not an identifier: %s", pname, 0); + if (isident(pname)) + zerrnam(cname, "not valid in this context: %s", pname, 0); + else + zerrnam(cname, "not an identifier: %s", pname, 0); return NULL; } |