diff --git a/libs/utils/src/CString.cpp b/libs/utils/src/CString.cpp index 5955568587..e108545e31 100644 --- a/libs/utils/src/CString.cpp +++ b/libs/utils/src/CString.cpp @@ -40,7 +40,8 @@ CString::CString(const char* cstr, size_t length) { p->length = (size_type)length; mCStr = (value_type*)(p + 1); // we don't use memcpy here to avoid a call to libc, the generated code is pretty good. - std::uninitialized_copy_n(cstr, length + 1, mCStr); + std::uninitialized_copy_n(cstr, length, mCStr); + mCStr[length] = '\0'; } }