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

Re: Bug#101523: zsh segmentation fault

"Bart Schaefer" wrote:
> It's happening when the `=' parameter is (not) restored upon exit from the
> function.  I'm not sure that's really the root cause, though.

No, I think it's when it (or something completely different --- there's no
`=' special parameter) is being saved.  The following looks a safe fix.
Unless anyone knows any better, this will go on both branches.  (Saved
parameters go on the heap since the list they're saved on is removed when
the scope exits.)

Index: Src/exec.c
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.28
diff -u -r1.28 exec.c
--- Src/exec.c	2001/05/28 09:00:22	1.28
+++ Src/exec.c	2001/06/20 09:58:32
@@ -2395,7 +2395,7 @@
 	    } else if (!(pm->flags & PM_READONLY) &&
 		       (unset(RESTRICTED) || !(pm->flags & PM_RESTRICTED))) {
 		Param tpm = (Param) zhalloc(sizeof *tpm);
-		tpm->nam = s;
+		tpm->nam = dupstring(s);
 		copyparam(tpm, pm, 1);
 		pm = tpm;

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

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