Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Commit

Permalink
CORE: sanity check on charID of logging in char
Browse files Browse the repository at this point in the history
  • Loading branch information
teschnei committed Apr 23, 2014
1 parent 3f85391 commit 794a2f6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/map/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,21 @@ int32 recv_parse(int8* buff, size_t* buffsize, sockaddr_in* from, map_session_da
{
uint32 CharID = RBUFL(buff,FFXI_HEADER_SIZE+0x0C);

const int8* fmtQuery = "SELECT session_key FROM accounts_sessions WHERE charid = %u LIMIT 1;";
const int8* fmtQuery = "SELECT charid FROM chars WHERE charid = %u LIMIT 1;";

int32 ret = Sql_Query(SqlHandle,fmtQuery,CharID);
int32 ret = Sql_Query(SqlHandle, fmtQuery, CharID);

if (ret == SQL_ERROR ||
Sql_NumRows(SqlHandle) == 0 ||
Sql_NextRow(SqlHandle) != SQL_SUCCESS)
{
ShowError(CL_RED"recv_parse: Cannot load charid %u" CL_RESET, CharID);
return -1;
}

fmtQuery = "SELECT session_key FROM accounts_sessions WHERE charid = %u LIMIT 1;";

ret = Sql_Query(SqlHandle,fmtQuery,CharID);

if (ret == SQL_ERROR ||
Sql_NumRows(SqlHandle) == 0 ||
Expand Down

0 comments on commit 794a2f6

Please sign in to comment.