1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-10 15:46:11 +02:00
git/compat
Johannes Schindelin ca1b411648 mingw: safe-guard a bit more against getenv() problems
Running up to v2.21.0, we fixed two bugs that were made prominent by the
Windows-specific change to retain copies of only the 30 latest getenv()
calls' returned strings, invalidating any copies of previous getenv()
calls' return values.

While this really shines a light onto bugs of the form where we hold
onto getenv()'s return values without copying them, it is also a real
problem for users.

And even if Jeff King's patches merged via 773e408881 (Merge branch
'jk/save-getenv-result', 2019-01-29) provide further work on that front,
we are far from done. Just one example: on Windows, we unset environment
variables when spawning new processes, which potentially invalidates
strings that were previously obtained via getenv(), and therefore we
have to duplicate environment values that are somehow involved in
spawning new processes (e.g. GIT_MAN_VIEWER in show_man_page()).

We do not have a chance to investigate, let address, all of those issues
in time for v2.21.0, so let's at least help Windows users by increasing
the number of getenv() calls' return values that are kept valid. The
number 64 was determined by looking at the average number of getenv()
calls per process in the entire test suite run on Windows (which is
around 40) and then adding a bit for good measure. And it is a power of
two (which would have hit yesterday's theme perfectly).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-02-15 10:25:28 -08:00
..
nedmalloc
poll poll: use GetTickCount64() to avoid wrap-around issues 2018-11-05 13:02:42 +09:00
regex compat/regex/regcomp.c: define intptr_t and uintptr_t on NonStop 2019-01-03 14:16:20 -08:00
vcbuild vcbuild/README: update to accommodate for missing common-cmds.h 2018-07-16 14:30:34 -07:00
win32 Merge branch 'tb/use-common-win32-pathfuncs-on-cygwin' 2019-01-14 15:29:32 -08:00
apple-common-crypto.h
basename.c
bswap.h bswap: add 64 bit endianness helper get_be64 2017-09-24 10:39:37 +09:00
fileno.c git-compat-util: work around fileno(fp) that is a macro 2019-02-12 10:01:59 -08:00
fopen.c
gmtime.c
hstrerror.c
inet_ntop.c
inet_pton.c
memmem.c
mingw.c mingw: safe-guard a bit more against getenv() problems 2019-02-15 10:25:28 -08:00
mingw.h Merge branch 'js/mingw-host-cpu' 2019-02-13 18:18:43 -08:00
mkdir.c
mkdtemp.c
mmap.c compat: make sure git_mmap is not expected to write 2018-10-25 18:51:03 +09:00
msvc.c
msvc.h msvc: directly use MS version (_stricmp) of strcasecmp 2018-11-20 10:57:13 +09:00
obstack.c compat/obstack: fix -Wcast-function-type warnings 2019-01-17 11:13:38 -08:00
obstack.h compat/obstack: fix -Wcast-function-type warnings 2019-01-17 11:13:38 -08:00
pread.c
precompose_utf8.c Support working-tree-encoding "UTF-16LE-BOM" 2019-01-31 10:27:52 -08:00
precompose_utf8.h compat/precompose_utf8.h: use more common include guard style 2018-08-15 11:52:09 -07:00
qsort.c
qsort_s.c
setenv.c
sha1-chunked.c
sha1-chunked.h
snprintf.c
stat.c
strcasestr.c
strdup.c
strlcpy.c
strtoimax.c
strtoumax.c
terminal.c
terminal.h
unsetenv.c
win32.h
win32mmap.c
winansi.c mingw: fix isatty() after dup2() 2018-10-31 12:48:59 +09:00