Prevent undefined memcpy calls
This commit is contained in:
parent
f6d44c38fc
commit
8d51604f02
@ -139,8 +139,10 @@ namespace rexy{
|
|||||||
if(newsize < m_cap)
|
if(newsize < m_cap)
|
||||||
return false;
|
return false;
|
||||||
string_intermediary tmp(newsize);
|
string_intermediary tmp(newsize);
|
||||||
memcpy(tmp.get(), m_data, m_length);
|
if(m_data){
|
||||||
tmp[m_length] = 0;
|
memcpy(tmp.get(), m_data, m_length);
|
||||||
|
tmp[m_length] = 0;
|
||||||
|
}
|
||||||
*this = std::move(tmp);
|
*this = std::move(tmp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -152,7 +154,8 @@ namespace rexy{
|
|||||||
m_data[m_length] = 0;
|
m_data[m_length] = 0;
|
||||||
}else{
|
}else{
|
||||||
string_intermediary tmp(detail::max(m_length + len, m_cap*2));
|
string_intermediary tmp(detail::max(m_length + len, m_cap*2));
|
||||||
memcpy(tmp.m_data, m_data, m_length);
|
if(m_data)
|
||||||
|
memcpy(tmp.m_data, m_data, m_length);
|
||||||
memcpy(tmp.m_data+m_length, data, len);
|
memcpy(tmp.m_data+m_length, data, len);
|
||||||
tmp.m_length = len+m_length;
|
tmp.m_length = len+m_length;
|
||||||
tmp[m_length+len] = 0;
|
tmp[m_length+len] = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user