public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: build_env: fix off-by-one bug when re-adding PATH
@ 2019-08-07 9:11 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-08-07 9:11 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=472fbb8b97d35fc636be059bf733d390b0671f4d
commit 472fbb8b97d35fc636be059bf733d390b0671f4d
Author: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Wed Aug 7 10:51:16 2019 +0200
Cygwin: build_env: fix off-by-one bug when re-adding PATH
Adding default winvar 'PATH=C:\cygwin64\binZ' to an environment that is
already allocated for 'SYSTEMROOT=ZWINDIR=Z', we need to count that
trailing (Z)ero as well. Otherwise we trigger this assertion failure:
$ /bin/env -i SYSTEMROOT= WINDIR= /bin/env
assertion "(s - envblock) <= tl" failed: file "/home/corinna/src/cygwin/cygwin-3.0.7/cygwin-3.0.7-1.x86_64/src/newlib-cygwin/winsup/cygwin/environ.cc", line 1302, function: char** build_env(const char* const*, WCHAR*&, int&, bool, HANDLE)
Aborted (core dumped)
Diff:
---
winsup/cygwin/environ.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 1248427..8fa01b2 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -1295,7 +1295,7 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
during execve. */
if (!saw_PATH)
{
- new_tl += cygheap->installation_dir.Length / sizeof (WCHAR) + 5;
+ new_tl += cygheap->installation_dir.Length / sizeof (WCHAR) + 5 + 1;
if (new_tl > tl)
tl = raise_envblock (new_tl, envblock, s);
s = wcpcpy (wcpcpy (s, L"PATH="),
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-07 9:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07 9:11 [newlib-cygwin] Cygwin: build_env: fix off-by-one bug when re-adding PATH Corinna Vinschen
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 read-only IMAP folder(s) and NNTP newsgroup(s).