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:
Robert Müller 2023-08-11 17:17:35 +02:00
parent 29871fd5f6
commit 0196470e01

View file

@ -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 "