mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix SQL query buffer sizes being too small
In `LoadPlayerData` exactly the `LIMIT 1` clause was getting truncated from the query due to the buffer size being insufficient. Depending on the length of the table name prefix the query could have been truncated at any other position resulting in syntax errors. In `ShowTeamTop5` the buffer size is increased because it could cause truncation with a longer than default table name prefix.
This commit is contained in:
parent
29871fd5f6
commit
0196470e01
|
@ -128,7 +128,7 @@ bool CScoreWorker::LoadPlayerData(IDbConnection *pSqlServer, const ISqlData *pGa
|
|||
auto *pResult = dynamic_cast<CScorePlayerResult *>(pGameData->m_pResult.get());
|
||||
pResult->SetVariant(CScorePlayerResult::PLAYER_INFO);
|
||||
|
||||
char aBuf[512];
|
||||
char aBuf[1024];
|
||||
// get best race time
|
||||
str_format(aBuf, sizeof(aBuf),
|
||||
"SELECT"
|
||||
|
@ -1002,7 +1002,7 @@ bool CScoreWorker::ShowTeamTop5(IDbConnection *pSqlServer, const ISqlData *pGame
|
|||
const char *pOrder = pData->m_Offset >= 0 ? "ASC" : "DESC";
|
||||
|
||||
// check sort method
|
||||
char aBuf[512];
|
||||
char aBuf[1024];
|
||||
|
||||
str_format(aBuf, sizeof(aBuf),
|
||||
"SELECT Name, Time, Ranking, TeamSize "
|
||||
|
|
Loading…
Reference in a new issue