summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2020-06-24 13:59:26 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2020-06-24 15:14:25 +0530
commit4c2cde1bef1533dd989cb6a37c482c3437d66403 (patch)
tree743e9cf69fd224d89ff5541ceee6e51378b50233 /sql/sql_base.cc
parenteba918977793f0995d2f4f7707fc5dd891da4064 (diff)
downloadmariadb-git-bb-10.2-MDEV-20643.tar.gz
MDEV-20643: Server crashes in find_table_in_list upon INSERT .. SELECT after dropping a databasebb-10.2-MDEV-20643
table->db is NULL, so strcmp() in find_tables_in_list() gets NULL in the argument. So it crashes. Fix: Using a safe_strcmp() function which compares two strings if they are not null otherwise uses safe_str() to convert the NULL string into empty string before comparing them.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 436f753557e..0aff16e6147 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -939,8 +939,8 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
{
for (; table; table= table->*link )
{
- if (strcmp(table->db, db_name) == 0 &&
- strcmp(table->table_name, table_name) == 0)
+ if (safe_strcmp(table->db, db_name) == 0 &&
+ safe_strcmp(table->table_name, table_name) == 0)
break;
}
return table;