Skip to content

Commit

Permalink
Fix SQL query buffer sizes being too small
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Robyt3 committed Aug 11, 2023
1 parent 29871fd commit 0196470
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/game/server/scoreworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 "
Expand Down

0 comments on commit 0196470

Please sign in to comment.