zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: horror in zexecve
@ 2004-05-21 11:10 Peter Stephenson
  2004-05-21 11:41 ` Alexandre Duret-Lutz
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2004-05-21 11:10 UTC (permalink / raw)
  To: Zsh hackers list

I finally installed valgrind on my Debian laptop and it immediately
found this problem.  If "_" is not in the environment, it replaces the
NULL at then end of the environment with that, and adds a NULL at the
next memory location.  Yuk.

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.61
diff -u -r1.61 exec.c
--- Src/exec.c	23 Apr 2004 11:17:15 -0000	1.61
+++ Src/exec.c	21 May 2004 11:08:28 -0000
@@ -352,18 +352,13 @@
     for (eep = argv; *eep; eep++)
 	if (*eep != pth)
 	    unmetafy(*eep, NULL);
-    for (eep = environ; *eep; eep++)
-	if (**eep == '_' && (*eep)[1] == '=')
-	    break;
     buf[0] = '_';
     buf[1] = '=';
     if (*pth == '/')
 	strcpy(buf + 2, pth);
     else
 	sprintf(buf + 2, "%s/%s", pwd, pth);
-    if (!*eep)
-	eep[1] = NULL;
-    *eep = buf;
+    zputenv(buf);
     closedumps();
     execve(pth, argv, environ);
 
Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.81
diff -u -r1.81 params.c
--- Src/params.c	6 Apr 2004 13:01:10 -0000	1.81
+++ Src/params.c	21 May 2004 11:08:29 -0000
@@ -3297,7 +3297,8 @@
 }
 
 
-static int
+/**/
+int
 zputenv(char *str)
 {
 #ifdef HAVE_PUTENV

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: horror in zexecve
  2004-05-21 11:10 PATCH: horror in zexecve Peter Stephenson
@ 2004-05-21 11:41 ` Alexandre Duret-Lutz
  2004-05-21 13:12   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Duret-Lutz @ 2004-05-21 11:41 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

On Fri, May 21, 2004 at 12:10:21PM +0100, Peter Stephenson wrote:
> I finally installed valgrind on my Debian laptop and it immediately
> found this problem.  If "_" is not in the environment, it replaces the
> NULL at then end of the environment with that, and adds a NULL at the
> next memory location.  Yuk.

This reminds me 16929.  Sorry I never pinged about it.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: horror in zexecve
  2004-05-21 11:41 ` Alexandre Duret-Lutz
@ 2004-05-21 13:12   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2004-05-21 13:12 UTC (permalink / raw)
  To: Zsh hackers list

Alexandre Duret-Lutz wrote:
> This reminds me 16929.  Sorry I never pinged about it.

Ah, yes, it's the same fix.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-21 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-21 11:10 PATCH: horror in zexecve Peter Stephenson
2004-05-21 11:41 ` Alexandre Duret-Lutz
2004-05-21 13:12   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).