_snprintf() differs from snprintf() in:
* on overflow it returns -1 instead of required buffer size
* on overflow it does not fill nul byte
* does not accept NULL/0 as a buffer
Microsoft implemented snprintf() in Visual Studio 2015 as part of UCRT.
Mingw32 contains snprintf() implementation only when __USE_MINGW_ANSI_STDIO
is defined.
Mingw-w64 versions prior to 8.0.0. contain snprintf() implementation when
__USE_MINGW_ANSI_STDIO or _UCRT is defined. Since version 8.0.0 it is
always supported.
Mingw-w64 defines both __MINGW32__ and __MINGW64_VERSION_MAJOR macros.
Mingw32 defines only __MINGW32__.
_scprintf() just count number of bytes needed for formatting string, so it
is basically return value of snprintf().
This change updates miniupnpc code to use snprintf() when is provided by
compiler/runtime to avoid usage _snprintf().
And also this changes updates miniupnpc emulation of snprintf() by
_snprintf() and _scprintf() functions to avoid buffer overflows.
For inspiration full emulation of snprintf() by _snprintf() is available in
mingw-w64 stdio library:
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-crt/stdio/snprintf.c
Check for 0.0.0.0, 192.168., 10. and 172. is not enough. Nowadays routers
behind NAT are getting IP address from shared CG-NAT space 100.64.0.0/10.
This patch adjust miniupnpc to check for all reserved IPv4 addresses.
* Ensure that all executables would have .exe Windows extension
* Do not use dll subdirectory, so makefile would be slash agnostic
* Define common targets to simplify makefile
* Export required functions for listdevices executable
This parameter was already present in the C API but not exposed to the
python module.
For backward compatibility, leaseDuration was made optional with a
default value of 0 (unlimited duration).
- Python 3.7 is built using Visual Studio 2017 so we use the corresponding image.
- Python 3.7 replaces Python 2.7 when building the module.
- Adding the library legacy_stdio_definitions to the linker input as starting with VS 2015 some symbols have been inlined but may be expected by older binaries. This compatibility library exposes these symbols so they can be dynamically linked when required (Cf. https://stackoverflow.com/a/32418900).