Fix CAdminData buffer overrun

Adjust admin.sma array sizes and DB sizes
This commit is contained in:
Ignacio DM 2021-04-26 03:33:11 -03:00
parent 9fbf91ded0
commit 6119ef7ae2
2 changed files with 6 additions and 6 deletions

View File

@ -286,7 +286,7 @@ public:
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)
{
@ -305,7 +305,7 @@ public:
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)
{

View File

@ -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))
}
@ -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)
query = SQL_PrepareQuery(sql,"SELECT `auth`,`password`,`access`,`flags` FROM `%s`", table)
}
@ -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];