1
0
mirror of https://github.com/git/git.git synced 2024-11-18 02:14:03 +01:00
git/compat
Johannes Schindelin 9ee0540a40 mingw: abort on invalid strftime formats
On Windows, strftime() does not silently ignore invalid formats, but
warns about them and then returns 0 and sets errno to EINVAL.

Unfortunately, Git does not expect such a behavior, as it disagrees
with strftime()'s semantics on Linux. As a consequence, Git
misinterprets the return value 0 as "I need more space" and grows the
buffer. As the larger buffer does not fix the format, the buffer grows
and grows and grows until we are out of memory and abort.

Ideally, we would switch off the parameter validation just for
strftime(), but we cannot even override the invalid parameter handler
via _set_thread_local_invalid_parameter_handler() using MINGW because
that function is not declared. Even _set_invalid_parameter_handler(),
which *is* declared, does not help, as it simply does... nothing.

So let's just bite the bullet and override strftime() for MINGW and
abort on an invalid format string. While this does not provide the
best user experience, it is the best we can do.

See https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx for more
details.

This fixes https://github.com/git-for-windows/git/issues/863

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-19 10:53:17 -07:00
..
nedmalloc
poll Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
regex Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
vcbuild
win32 Win32: simplify loading of DLL functions 2017-09-26 11:02:49 +09: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
cygwin.c cygwin: allow pushing to UNC paths 2017-07-05 14:01:03 -07:00
cygwin.h cygwin: allow pushing to UNC paths 2017-07-05 14:01:03 -07:00
fopen.c git_fopen: fix a sparse 'not declared' warning 2017-05-26 12:33:55 +09:00
gmtime.c
hstrerror.c
inet_ntop.c
inet_pton.c
memmem.c
mingw.c mingw: abort on invalid strftime formats 2018-03-19 10:53:17 -07:00
mingw.h mingw: abort on invalid strftime formats 2018-03-19 10:53:17 -07:00
mkdir.c
mkdtemp.c
mmap.c
msvc.c
msvc.h
obstack.c Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
obstack.h Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
pread.c
precompose_utf8.c config: don't include config.h by default 2017-06-15 12:56:22 -07:00
precompose_utf8.h
qsort_s.c
qsort.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 winansi: avoid buffer overrun 2017-05-08 12:18:19 +09:00