From 51d3cc945fe388c776a1a20683ba8ff1c2f191e2 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 18 Oct 2016 02:02:49 -0400 Subject: [PATCH] Switch to std::copy due to MinGW issues with memcpy_s Also see http://github.com/weidai11/cryptopp/issues/28 and http://groups.google.com/d/msg/cryptopp-users/PRTVKTh0gRk/euPM_TzdBAAJ --- validat1.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/validat1.cpp b/validat1.cpp index fdda7957..b91eaf29 100644 --- a/validat1.cpp +++ b/validat1.cpp @@ -173,17 +173,19 @@ bool ValidateAll(bool thorough) bool TestSettings() { - // Thanks to IlyaBizyaev and Zireael, http://github.com/weidai11/cryptopp/issues/28 -#if defined(__MINGW32__) - using CryptoPP::memcpy_s; -#endif - bool pass = true; cout << "\nTesting Settings...\n\n"; word32 w; - memcpy_s(&w, sizeof(w), "\x01\x02\x03\x04", 4); + const byte s[] = "\x01\x02\x03\x04"; + +#if (CRYPTOPP_MSC_VERSION >= 1400) + std::copy(s, s+4, + stdext::make_checked_array_iterator(reinterpret_cast(&w), sizeof(w))); +#else + std::copy(s, s+4, reinterpret_cast(&w)); +#endif if (w == 0x04030201L) {