diff --git a/deps/miniv8/src/MiniV8Api.cpp b/deps/miniv8/src/MiniV8Api.cpp index 8c00d4343fabd00b3b8f6f5a1fcf917e5e32024d..ccfdd489d9d4b19f35404588aeaec3204fb330ab 100644 --- a/deps/miniv8/src/MiniV8Api.cpp +++ b/deps/miniv8/src/MiniV8Api.cpp @@ -1848,13 +1848,16 @@ v8::String::Utf8Value::Utf8Value(v8::Local str) miniv8::V8String* v8string = v8::Utils::openHandle(*(str.As())); const std::string& strv8 = v8string->getStr(); - this->str_ = (char*)strv8.c_str(); this->length_ = (int)strv8.size(); + this->str_ = new char[this->length_ + 1]; + std::strncpy(this->str_, strv8.c_str(), this->length_ + 1); + this->str_[this->length_] = '\0'; } v8::String::Utf8Value::~Utf8Value(void) { printEmptyFuncInfo(__FUNCTION__, false, false); + delete[] str_; } #if V8_MINOR_VERSION < 8