Skip to content

Commit

Permalink
Merge pull request #33731 from madmiraal/fix-c4996-warning
Browse files Browse the repository at this point in the history
Fix Visual Studio throwing C4996 warning in ustring.cpp.
  • Loading branch information
akien-mga authored Feb 11, 2020
2 parents 6fb6405 + 70b0fad commit 0b4b248
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/ustring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0b4b248

Please sign in to comment.