mirror of https://github.com/status-im/evmc.git
loader: Use strcpy_sx() everywhere
Previously we used strcpy_s() standard library function on Windows, but it triggers some additional handlers in some cases. To have the same behavior use strcpy_sx() everywhere.
This commit is contained in:
parent
5f307ea325
commit
45da8cfce8
|
@ -42,20 +42,14 @@
|
|||
#define ATTR_FORMAT(...)
|
||||
#endif
|
||||
|
||||
#if _WIN32
|
||||
#define strcpy_sx strcpy_s
|
||||
#else
|
||||
/*
|
||||
* Limited variant of strcpy_s().
|
||||
*
|
||||
* Provided for C standard libraries where strcpy_s() is not available.
|
||||
* The availability check might need to adjusted for other C standard library implementations.
|
||||
*/
|
||||
#if !defined(EVMC_LOADER_MOCK)
|
||||
static
|
||||
#endif
|
||||
int
|
||||
strcpy_sx(char* restrict dest, size_t destsz, const char* restrict src)
|
||||
strcpy_sx(char* dest, size_t destsz, const char* src)
|
||||
{
|
||||
size_t len = strlen(src);
|
||||
if (len >= destsz)
|
||||
|
@ -70,7 +64,6 @@ static
|
|||
dest[len] = 0;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define PATH_MAX_LENGTH 4096
|
||||
|
||||
|
|
|
@ -16,12 +16,8 @@ static constexpr bool is_windows = false;
|
|||
#endif
|
||||
|
||||
extern "C" {
|
||||
#if _WIN32
|
||||
#define strcpy_sx strcpy_s
|
||||
#else
|
||||
/// Declaration of internal function defined in loader.c.
|
||||
int strcpy_sx(char* dest, size_t destsz, const char* src);
|
||||
#endif
|
||||
|
||||
/// The library path expected by mocked evmc_test_load_library().
|
||||
extern const char* evmc_test_library_path;
|
||||
|
|
Loading…
Reference in New Issue