diff options
Diffstat (limited to 'core')
-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) { |