From f8dabfa294b147afbb245588f964ce94d12ea7cd Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 4 Oct 2021 18:06:40 -0300 Subject: [PATCH] Use portable memcpy instead of memcpy_s --- src/app/script/image_class.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/script/image_class.cpp b/src/app/script/image_class.cpp index 8bdf4e4e9..cd694194a 100644 --- a/src/app/script/image_class.cpp +++ b/src/app/script/image_class.cpp @@ -33,6 +33,7 @@ #include "render/render.h" #include +#include #include namespace app { @@ -497,7 +498,7 @@ int Image_set_bytes(lua_State* L) const char* bytes = lua_tolstring(L, 2, &bytes_size); if (bytes_size == bytes_needed) { - memcpy_s(img->getPixelAddress(0, 0), bytes_needed, bytes, bytes_size); + std::memcpy(img->getPixelAddress(0, 0), bytes, std::min(bytes_needed, bytes_size)); } else { lua_pushfstring(L, "Data size does not match: given %d, needed %d.", bytes_size, bytes_needed);