forked from premiere/premiere-libtorrent
parent
e1dcf82e2a
commit
d8b413c771
|
@ -80,7 +80,8 @@ namespace libtorrent { namespace aux
|
|||
int const ret = int(m_storage.size());
|
||||
int const len = int(std::strlen(str));
|
||||
m_storage.resize(ret + len + 1);
|
||||
std::strcpy(&m_storage[ret], str);
|
||||
std::memcpy(&m_storage[ret], str, len);
|
||||
m_storage[ret + len] = '\0';
|
||||
return allocation_slot(ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -160,9 +160,11 @@ namespace libtorrent
|
|||
char* allocate_string_copy(char const* str)
|
||||
{
|
||||
if (str == nullptr) return nullptr;
|
||||
char* tmp = static_cast<char*>(std::malloc(std::strlen(str) + 1));
|
||||
int const len = int(std::strlen(str));
|
||||
char* tmp = static_cast<char*>(std::malloc(len + 1));
|
||||
if (tmp == nullptr) return nullptr;
|
||||
std::strcpy(tmp, str);
|
||||
std::memcpy(tmp, str, len);
|
||||
tmp[len] = '\0';
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue