Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: bug with hash builtin
- X-seq: zsh-workers 25983
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: PATCH: bug with hash builtin
- Date: Fri, 31 Oct 2008 12:10:25 +0100
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:Received:From:To:Subject:Date:Message-ID; b=dlkMLxyCdU73ve3CAGwVJ8g8PH1CokfDrbv+9l+bg6gbASSNo70+CXKEl3h4WkAX6cIrpxai5kzFQRF7kcST5cLiDVsnHFqPQASMAw/OcfHxFsIiBYlbULB3lTc3Nqs/lU+vf+7VWd49B8Vt83ENJ4LYTfEP0CjKT02Oc/5cRkE= ;
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
This was found by coverity:
hash =
causes a seg fault.
A patch is below. I'm not sure about the error message because it isn't
really an assignment but I can't think of anything better. Does anyone
think it would be better to avoid the use of the continue statement here
at the cost of having to further indent quite a few lines.
Oliver
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.215
diff -u -r1.215 builtin.c
--- Src/builtin.c 30 Oct 2008 19:52:44 -0000 1.215
+++ Src/builtin.c 31 Oct 2008 11:00:22 -0000
@@ -3262,7 +3262,7 @@
}
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 @@
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 @@
ht->printnode(hn, 0);
} else if(OPT_ISSET(ops,'v'))
ht->printnode(hn, 0);
- argv++;
}
unqueue_signals();
return returnval;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author