diff --git a/components/esm/esmcommon.hpp b/components/esm/esmcommon.hpp index bb4069d262..749e9a85d6 100644 --- a/components/esm/esmcommon.hpp +++ b/components/esm/esmcommon.hpp @@ -1,6 +1,7 @@ #ifndef OPENMW_ESM_COMMON_H #define OPENMW_ESM_COMMON_H +#include #include #include #include @@ -110,8 +111,7 @@ struct FIXED_STRING<4> : public FIXED_STRING_BASE void assign(const std::string& value) { intval = 0; - std::memcpy(data, value.data(), (value.size() < 4)? value.size(): 4); - + std::memcpy(data, value.data(), std::min(value.size(), sizeof(data))); } char const* ro_data() const { return data; }