Fix a bug on COW of the std::string class

This commit is contained in:
antao 2019-01-07 13:34:37 +08:00
parent 951e179e24
commit 6b854ffe6f
1 changed files with 1 additions and 1 deletions

View File

@ -376,7 +376,7 @@ std::shared_ptr<std::string> HttpResponseImpl::renderToString() const
{
std::lock_guard<std::mutex> lock(*_httpStringMutex);
_httpString = std::make_shared<std::string>(*_httpString);
memcpy((void *)(_httpString->data() + _datePos), newDate, strlen(newDate));
memcpy((void *)&(*_httpString)[_datePos], newDate, strlen(newDate));
return _httpString;
}
}