Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CAdminData buffer overrun #959

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions amxmodx/CMisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class CAdminData
void SetAuthID(const cell *Input)
{
unsigned int i=0;
while (i<sizeof(m_AuthData)-1)
while (i<arraysize(m_AuthData)-1)
{
if ((m_AuthData[i++]=*Input++)==0)
{
Expand All @@ -305,7 +305,7 @@ class CAdminData
void SetPass(const cell *Input)
{
unsigned int i=0;
while (i<sizeof(m_Password)-1)
while (i<arraysize(m_Password)-1)
{
if ((m_Password[i++]=*Input++)==0)
{
Expand Down
8 changes: 4 additions & 4 deletions plugins/admin.sma
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ public addadminfn(id, level, cid)
return PLUGIN_HANDLED
}

new flags[64]
new flags[32]
read_argv(2, flags, charsmax(flags))

new password[64]
new password[32]
if (read_argc() >= 4) {
read_argv(3, password, charsmax(password))
}
Expand Down Expand Up @@ -444,7 +444,7 @@ public adminSql()

query = SQL_PrepareQuery(sql, "SELECT auth, password, access, flags FROM %s", table)
} else {
SQL_QueryAndIgnore(sql, "CREATE TABLE IF NOT EXISTS `%s` ( `auth` VARCHAR( 32 ) NOT NULL, `password` VARCHAR( 32 ) NOT NULL, `access` VARCHAR( 32 ) NOT NULL, `flags` VARCHAR( 32 ) NOT NULL ) COMMENT = 'AMX Mod X Admins'", table)
SQL_QueryAndIgnore(sql, "CREATE TABLE IF NOT EXISTS `%s` ( `auth` VARCHAR( 43 ) NOT NULL, `password` VARCHAR( 31 ) NOT NULL, `access` VARCHAR( 31 ) NOT NULL, `flags` VARCHAR( 31 ) NOT NULL ) COMMENT = 'AMX Mod X Admins'", table)
IgnacioFDM marked this conversation as resolved.
Show resolved Hide resolved
query = SQL_PrepareQuery(sql,"SELECT `auth`,`password`,`access`,`flags` FROM `%s`", table)
}

Expand All @@ -465,7 +465,7 @@ public adminSql()
new qcolFlags = SQL_FieldNameToNum(query, "flags")

new AuthData[44];
new Password[44];
new Password[32];
new Access[32];
new Flags[32];

Expand Down