diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2020-06-24 13:59:26 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2020-06-24 15:14:25 +0530 |
commit | 4c2cde1bef1533dd989cb6a37c482c3437d66403 (patch) | |
tree | 743e9cf69fd224d89ff5541ceee6e51378b50233 /sql/sql_base.cc | |
parent | eba918977793f0995d2f4f7707fc5dd891da4064 (diff) | |
download | mariadb-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.cc | 4 |
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; |