Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / String / String.cpp
diff options
context:
space:
mode:
1 files changed, 2 insertions, 1 deletions
-rw-r--r--src/Generic/String/String.cpp3
diff --git a/src/Generic/String/String.cpp b/src/Generic/String/String.cpp
index 069a1df..2e9d50e 100644
--- a/src/Generic/String/String.cpp
+++ b/src/Generic/String/String.cpp
@@ -18,7 +18,8 @@ void String::copyFrom(const String& other) {
String::String(const char* str) {
length = strlen(str);
this->str = new char[length + 1]; // capture terminating zero
- strncpy(this->str, str, length + 1);
+ strncpy(this->str, str, length);
+ this->str[length] = '\0';
}
const char* String::get_cstr() const {