Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: horror in zexecve
- X-seq: zsh-workers 19971
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: PATCH: horror in zexecve
- Date: Fri, 21 May 2004 12:10:21 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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@xxxxxxx> 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
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author