diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-11 10:22:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 10:22:36 +0100 |
commit | 0b4b24883d8fe7ee3f4c7a861df0bad1d12a319c (patch) | |
tree | 5c76de23b233cc2e37db1ba50321aa8f4aa07208 /core/ustring.cpp | |
parent | 6fb64054088d0b4da2b35d3d730820550605f7a7 (diff) | |
parent | 70b0fad25a0e35ddcbf4b83d3efcdf861ee2c8f3 (diff) | |
download | redot-engine-0b4b24883d8fe7ee3f4c7a861df0bad1d12a319c.tar.gz |
Merge pull request #33731 from madmiraal/fix-c4996-warning
Fix Visual Studio throwing C4996 warning in ustring.cpp.
Diffstat (limited to 'core/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 08418463a0..8030efcc2b 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -146,9 +146,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) { |