Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: zparseopts causes core dump



Tanaka Akira wrote:

> zparseopts causes core dump as follows.
> 
> Z(4):akr@serein% Src/zsh -f 
> serein% set - -a
> serein% zparseopts -a=xxx
> zsh: segmentation fault (core dumped)  Src/zsh -f

`-a=xxx' is not a option description and zparseopts should catch that
case, right.

Bye
 Sven

Index: Src/Modules/zutil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zutil.c,v
retrieving revision 1.2
diff -u -r1.2 zutil.c
--- Src/Modules/zutil.c	2000/05/04 20:16:10	1.2
+++ Src/Modules/zutil.c	2000/05/15 08:00:59
@@ -1326,12 +1326,18 @@
 		}
 		break;
 	    }
-	    if (!o)
+	    if (!o) {
+		o = "";
 		break;
+	    }
 	} else {
 	    args--;
 	    break;
 	}
+    }
+    if (!o) {
+	zwarnnam(nam, "missing option descriptions", NULL, 0);
+	return 1;
     }
     while ((o = dupstring(*args++))) {
 	if (!*o) {

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author