std::strncpy back to strlcpy

This commit is contained in:
d1str4ught
2025-08-22 17:45:31 +02:00
parent 5c9ae80bcd
commit 920a3fc861
59 changed files with 309 additions and 309 deletions

View File

@@ -241,7 +241,7 @@ void LoginFailure(LPDESC d, const char * c_pszStatus)
TPacketGCLoginFailure failurePacket;
failurePacket.header = HEADER_GC_LOGIN_FAILURE;
std::strncpy(failurePacket.szStatus, c_pszStatus, sizeof(failurePacket.szStatus));
strlcpy(failurePacket.szStatus, c_pszStatus, sizeof(failurePacket.szStatus));
d->Packet(&failurePacket, sizeof(failurePacket));
}
@@ -395,7 +395,7 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
p.dwID = (DWORD)(atoi(msg.c_str()));
snprintf(szTmp,sizeof(szTmp),"Sent to DB cache to delete ItemAward, id: %d",p.dwID);
//sys_log(0,"%d",p.dwID);
// std::strncpy(p.login, msg.c_str(), sizeof(p.login));
// strlcpy(p.login, msg.c_str(), sizeof(p.login));
db_clientdesc->DBPacket(HEADER_GD_DELETE_AWARDID, 0, &p, sizeof(p));
stResult += szTmp;
}
@@ -446,14 +446,14 @@ dev_log(LOG_DEB0, "DC : '%s'", msg.c_str());
TPacketGGDisconnect pgg;
pgg.bHeader = HEADER_GG_DISCONNECT;
std::strncpy(pgg.szLogin, msg.c_str(), sizeof(pgg.szLogin));
strlcpy(pgg.szLogin, msg.c_str(), sizeof(pgg.szLogin));
P2P_MANAGER::instance().Send(&pgg, sizeof(TPacketGGDisconnect));
// delete login key
{
TPacketDC p;
std::strncpy(p.login, msg.c_str(), sizeof(p.login));
strlcpy(p.login, msg.c_str(), sizeof(p.login));
db_clientdesc->DBPacket(HEADER_GD_DC, 0, &p, sizeof(p));
}
}