From ae8c91ec0749282e220f9c56efee1444a072cf62 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 25 May 2005 19:42:10 +1000 Subject: [PATCH] - (dtucker) [openbsd-compat/bsd-cygwin_util.c] Ensure sufficient memory allocation when retrieving core Windows environment. Add CYGWIN variable to propagated variables. Patch from vinschen at redhat.com, ok djm@ --- ChangeLog | 5 ++++- openbsd-compat/bsd-cygwin_util.c | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7eab8fc9..24605b538 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ idea, it is now known as UNSUPPORTED_POSIX_THREADS_HACK. Attempting to use USE_POSIX_THREADS will now generate an error so we don't silently change behaviour. ok djm@ + - (dtucker) [openbsd-compat/bsd-cygwin_util.c] Ensure sufficient memory + allocation when retrieving core Windows environment. Add CYGWIN variable + to propagated variables. Patch from vinschen at redhat.com, ok djm@ 20050524 - (djm) [openbsd-compat/readpassphrase.c] bz #950: Retry tcsetattr to ensure @@ -2492,4 +2495,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.3758 2005/05/25 06:18:09 dtucker Exp $ +$Id: ChangeLog,v 1.3759 2005/05/25 09:42:10 dtucker Exp $ diff --git a/openbsd-compat/bsd-cygwin_util.c b/openbsd-compat/bsd-cygwin_util.c index f53abb6e2..b5e3cc52b 100644 --- a/openbsd-compat/bsd-cygwin_util.c +++ b/openbsd-compat/bsd-cygwin_util.c @@ -29,7 +29,7 @@ #include "includes.h" -RCSID("$Id: bsd-cygwin_util.c,v 1.13 2004/08/30 10:42:08 dtucker Exp $"); +RCSID("$Id: bsd-cygwin_util.c,v 1.14 2005/05/25 09:42:11 dtucker Exp $"); #ifdef HAVE_CYGWIN @@ -247,6 +247,7 @@ static struct wenv { { NL("COMMONPROGRAMFILES=") }, { NL("COMPUTERNAME=") }, { NL("COMSPEC=") }, + { NL("CYGWIN=") }, { NL("NUMBER_OF_PROCESSORS=") }, { NL("OS=") }, { NL("PATH=") }, @@ -260,7 +261,7 @@ static struct wenv { { NL("SYSTEMROOT=") }, { NL("TMP=") }, { NL("TEMP=") }, - { NL("WINDIR=") }, + { NL("WINDIR=") } }; char ** @@ -269,7 +270,7 @@ fetch_windows_environment(void) char **e, **p; int i, idx = 0; - p = xmalloc(WENV_SIZ * sizeof(char *)); + p = xmalloc((WENV_SIZ + 1) * sizeof(char *)); for (e = environ; *e != NULL; ++e) { for (i = 0; i < WENV_SIZ; ++i) { if (!strncmp(*e, wenv_arr[i].name, wenv_arr[i].namelen))