diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2008-10-31 23:43:36 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2008-10-31 23:43:36 +0000 |
commit | a9a516d219d1211d64047745c4de2c35eedd4a56 (patch) | |
tree | 835ab170f978ac45a719ec1d7d07ab39e123e75d | |
parent | 7ce5beb5be107311a177893c94a628f647f4a230 (diff) | |
download | zsh-a9a516d219d1211d64047745c4de2c35eedd4a56.tar.gz zsh-a9a516d219d1211d64047745c4de2c35eedd4a56.tar.xz zsh-a9a516d219d1211d64047745c4de2c35eedd4a56.zip |
25983: Fix bug in hash builtin with empty hash entry name
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/builtin.c | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index 601c81d52..81839bc43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-10-31 Oliver Kiddle <opk@zsh.org> + + * 25983: Fix bug in hash builtin with empty hash entry name + 2008-10-30 Peter Stephenson <p.w.stephenson@ntlworld.com> * 25975: Src/compmatch.c: bad tests for pattern match diff --git a/Src/builtin.c b/Src/builtin.c index 0b4ab7dcd..b6cd9610d 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -3262,7 +3262,7 @@ bin_hash(char *name, char **argv, Options ops, UNUSED(int func)) } queue_signals(); - while (*argv) { + for (;*argv;++argv) { void *hn; if (OPT_ISSET(ops,'m')) { /* with the -m option, treat the argument as a glob pattern */ @@ -3275,7 +3275,12 @@ bin_hash(char *name, char **argv, Options ops, UNUSED(int func)) zwarnnam(name, "bad pattern : %s", *argv); returnval = 1; } - } else if ((asg = getasg(*argv)) && asg->value) { + continue; + } + if (!(asg = getasg(*argv))) { + zwarnnam(name, "bad assignment"); + returnval = 1; + } else if (asg->value) { if(isset(RESTRICTED)) { zwarnnam(name, "restricted: %s", asg->value); returnval = 1; @@ -3323,7 +3328,6 @@ bin_hash(char *name, char **argv, Options ops, UNUSED(int func)) ht->printnode(hn, 0); } else if(OPT_ISSET(ops,'v')) ht->printnode(hn, 0); - argv++; } unqueue_signals(); return returnval; |