From 4a34c9628942a3631500e51b57ce4ccb4ac77fb4 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sat, 27 Sep 2008 19:57:25 +0000 Subject: 25755/25756: Jörg Sommer: improved handling of module arguments 25759: fix dynamic named directory crash, static named directory consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/builtin.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Src/builtin.c') diff --git a/Src/builtin.c b/Src/builtin.c index d274ef9ad..02f843bf8 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -3262,9 +3262,19 @@ bin_hash(char *name, char **argv, Options ops, UNUSED(int func)) /* The argument is of the form foo=bar, * * so define an entry for the table. */ if(OPT_ISSET(ops,'d')) { - Nameddir nd = hn = zshcalloc(sizeof *nd); - nd->node.flags = 0; - nd->dir = ztrdup(asg->value); + /* shouldn't return NULL if asg->name is not NULL */ + if (*itype_end(asg->name, IUSER, 0)) { + zwarnnam(name, + "invalid character in directory name: %s", + asg->name); + returnval = 1; + argv++; + continue; + } else { + Nameddir nd = hn = zshcalloc(sizeof *nd); + nd->node.flags = 0; + nd->dir = ztrdup(asg->value); + } } else { Cmdnam cn = hn = zshcalloc(sizeof *cn); cn->node.flags = HASHED; -- cgit v1.2.3