Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/sphereproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ enum RACE_TYPE // character race, used in new character creation (0x8D) and sta
#define MAX_NAME_SIZE 30

#define MAX_ACCOUNT_NAME_SIZE MAX_NAME_SIZE
#define MAX_ACCOUNT_PASSWORD_ENTER 16 // client only allows n chars.
#define MAX_ACCOUNT_PASSWORD_SIZE 30 // Max size defined by Login Request (0x80) packet.
#define ACCOUNT_NAME_VALID_CHAR " !\"#$%&()*,/:;<=>?@[\\]^{|}~"
#define MAX_CHARS_PER_ACCT (byte) 7

Expand Down
12 changes: 6 additions & 6 deletions src/game/clients/CAccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ bool CAccount::SetPassword( lpctstr pszPassword, bool isMD5Hash )
return true;
}

size_t actualPasswordBufferSize = minimum(MAX_ACCOUNT_PASSWORD_ENTER, enteredPasswordLength) + 1;
size_t actualPasswordBufferSize = minimum(MAX_ACCOUNT_PASSWORD_SIZE, enteredPasswordLength) + 1;
char * actualPassword = new char[actualPasswordBufferSize];
Str_CopyLimitNull(actualPassword, pszPassword, actualPasswordBufferSize);

Expand Down Expand Up @@ -1066,10 +1066,10 @@ void CAccount::SetNewPassword( lpctstr pszPassword )
static constexpr tchar passwdChars[] = "ABCDEFGHJKLMNPQRTUVWXYZ2346789";
int len = (int)strlen(passwdChars);
int charsCnt = g_Rand.GetVal(4) + 6; // 6 - 10 chars
if ( charsCnt > (MAX_ACCOUNT_PASSWORD_ENTER - 1) )
charsCnt = MAX_ACCOUNT_PASSWORD_ENTER - 1;
if ( charsCnt > (MAX_ACCOUNT_PASSWORD_SIZE - 1) )
charsCnt = MAX_ACCOUNT_PASSWORD_SIZE - 1;

tchar szTmp[MAX_ACCOUNT_PASSWORD_ENTER + 1];
tchar szTmp[MAX_ACCOUNT_PASSWORD_SIZE + 1];
for ( int i = 0; i < charsCnt; ++i )
szTmp[i] = passwdChars[g_Rand.GetVal(len)];

Expand All @@ -1079,8 +1079,8 @@ void CAccount::SetNewPassword( lpctstr pszPassword )
}

m_sNewPassword = pszPassword;
if ( m_sNewPassword.GetLength() > MAX_ACCOUNT_PASSWORD_ENTER )
m_sNewPassword.Resize(MAX_ACCOUNT_PASSWORD_ENTER);
if ( m_sNewPassword.GetLength() > MAX_ACCOUNT_PASSWORD_SIZE )
m_sNewPassword.Resize(MAX_ACCOUNT_PASSWORD_SIZE);
}

bool CAccount::SetResDisp(RESDISPLAY_VERSION what)
Expand Down
Loading