mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 15:08:19 +00:00
Use str_copy
instead of mem_copy
for skin names
The `mem_copy` function does not respect zero termination so it reads beyond the size of the source buffer, if it's smaller than the destination buffer.
This commit is contained in:
parent
32b32d7052
commit
fa0b218eed
|
@ -418,7 +418,7 @@ void CMenus::RandomSkin()
|
|||
unsigned *pColorBody = !m_Dummy ? &g_Config.m_ClPlayerColorBody : &g_Config.m_ClDummyColorBody;
|
||||
unsigned *pColorFeet = !m_Dummy ? &g_Config.m_ClPlayerColorFeet : &g_Config.m_ClDummyColorFeet;
|
||||
|
||||
mem_copy(pSkinName, pRandomSkinName, sizeof(g_Config.m_ClPlayerSkin));
|
||||
str_copy(pSkinName, pRandomSkinName, sizeof(g_Config.m_ClPlayerSkin));
|
||||
*pColorBody = Body.Pack(false);
|
||||
*pColorFeet = Feet.Pack(false);
|
||||
|
||||
|
@ -862,7 +862,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
const int NewSelected = s_ListBox.DoEnd();
|
||||
if(OldSelected != NewSelected)
|
||||
{
|
||||
mem_copy(pSkinName, s_vSkinList[NewSelected].m_pSkin->GetName(), sizeof(g_Config.m_ClPlayerSkin));
|
||||
str_copy(pSkinName, s_vSkinList[NewSelected].m_pSkin->GetName(), sizeof(g_Config.m_ClPlayerSkin));
|
||||
SetNeedSendInfo();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue