Skip to content

Commit

Permalink
chillout: Use secure string API in MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
tuffnatty committed Dec 17, 2023
1 parent d0580cb commit e2bfa75
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
**********************************************************************/
#ifdef _WIN32

#define MINGW_HAS_SECURE_API 1 // for strncpy_s and friends in MinGW-w64 < 7.0

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
Expand Down Expand Up @@ -241,11 +243,13 @@ DWORD64
#endif

#ifdef __MINGW32__
#ifndef __GOT_SECURE_LIB__
#define strcpy_s(dst, len, src) strcpy(dst, src)
#define strncpy_s(dst, len, src, maxLen) strncpy(dst, src, len)
#define strcat_s(dst, len, src) strcat(dst, src)
#define _snprintf_s _snprintf
#endif
#endif

static void MyStrCpy(char* szDest, size_t nMaxDestSize, const char* szSrc)
{
Expand Down

0 comments on commit e2bfa75

Please sign in to comment.