UCRT version of tmpnam() returns absolute path and L_tmpnam has to be defined to accomodate that.
Fixes buffer overflow in various software when building with UCRT. Fixes: https://sourceforge.net/p/mingw-w64/bugs/915/ Signed-off-by: Kacper Michajłow <[email protected]> --- mingw-w64-headers/crt/stdio.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index 5a121bb0f..1458addc7 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -56,7 +56,11 @@ extern "C" { #define _wP_tmpdir L"\\" #endif +#ifdef _UCRT +#define L_tmpnam 260 +#else #define L_tmpnam (sizeof(_P_tmpdir) + 12) +#endif #ifdef _POSIX_ #define L_ctermid 9 -- 2.34.1 _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
