diff options
author | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2019-11-18 21:51:54 +0100 |
---|---|---|
committer | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2019-11-19 14:47:12 +0000 |
commit | 70b0fad25a0e35ddcbf4b83d3efcdf861ee2c8f3 (patch) | |
tree | 045ff174ee91ec6d5f8012d4520f891f302ffb95 | |
parent | 95f1f4e82a948f064bbbe32812a3f4b5c3c90bb7 (diff) |
Fix Visual Studio throwing C4996 warning in ustring.cpp.
-rw-r--r-- | core/ustring.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 0f82ca7e15..d115ab7ae7 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -142,9 +142,11 @@ void CharString::copy_from(const char *p_cstr) { return; } - resize(len + 1); // include terminating null char + Error err = resize(++len); // include terminating null char - strcpy(ptrw(), p_cstr); + ERR_FAIL_COND_MSG(err != OK, "Failed to copy C-string."); + + memcpy(ptrw(), p_cstr, len); } void String::copy_from(const char *p_cstr) { |