summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorKristofer Pettersson <kristofer.pettersson@sun.com>2009-11-20 16:18:01 +0100
committerKristofer Pettersson <kristofer.pettersson@sun.com>2009-11-20 16:18:01 +0100
commit3771d623b1d7ea26bb59bc064b85ea7102246e1a (patch)
tree2c684f720a7791634409c9607d9ffcd82d0d1b73 /sql/sql_acl.cc
parente131edc9d4337104fbab030bb0827650954f226a (diff)
downloadmariadb-git-3771d623b1d7ea26bb59bc064b85ea7102246e1a.tar.gz
Bug#45613 handle failures from my_hash_insert
Not all my_hash_insert() calls are checked for return value. This patch adds appropriate checks and failure responses where needed.
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc22
1 files changed, 16 insertions, 6 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 35047ca7407..6580bc50b22 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2400,7 +2400,12 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
privs = cols = 0; /* purecov: deadcode */
return; /* purecov: deadcode */
}
- my_hash_insert(&hash_columns, (uchar *) mem_check);
+ if (my_hash_insert(&hash_columns, (uchar *) mem_check))
+ {
+ /* Invalidate this entry */
+ privs= cols= 0;
+ return;
+ }
} while (!col_privs->file->index_next(col_privs->record[0]) &&
!key_cmp_if_same(col_privs,key,0,key_prefix_len));
col_privs->file->ha_index_end();
@@ -2605,7 +2610,11 @@ static int replace_column_table(GRANT_TABLE *g_t,
goto end; /* purecov: inspected */
}
grant_column= new GRANT_COLUMN(column->column,privileges);
- my_hash_insert(&g_t->hash_columns,(uchar*) grant_column);
+ if (my_hash_insert(&g_t->hash_columns,(uchar*) grant_column))
+ {
+ result= -1;
+ goto end;
+ }
}
}
@@ -3130,12 +3139,12 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
Str->user.str, table_name,
rights,
column_priv);
- if (!grant_table) // end of memory
+ if (!grant_table ||
+ my_hash_insert(&column_priv_hash,(uchar*) grant_table))
{
result= TRUE; /* purecov: deadcode */
continue; /* purecov: deadcode */
}
- my_hash_insert(&column_priv_hash,(uchar*) grant_table);
}
/* If revoke_grant, calculate the new column privilege for tables_priv */
@@ -3339,12 +3348,13 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
grant_name= new GRANT_NAME(Str->host.str, db_name,
Str->user.str, table_name,
rights);
- if (!grant_name)
+ if (!grant_name ||
+ my_hash_insert(is_proc ?
+ &proc_priv_hash : &func_priv_hash,(uchar*) grant_name))
{
result= TRUE;
continue;
}
- my_hash_insert(is_proc ? &proc_priv_hash : &func_priv_hash,(uchar*) grant_name);
}
if (replace_routine_table(thd, grant_name, tables[1].table, *Str,