summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-10-22 14:41:47 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-10-22 14:41:47 +0300
commit71d4ecf182642dbb9ec7c155d3b2606b8b1fb4a2 (patch)
tree863c77156e486dec16505ba6586208879ad27e5f /sql/table.cc
parent45a376dd2d505af343cfff68e4343c7650f2565c (diff)
parent1f02280904fcfbb2bd86404d1c85c025634f8c9d (diff)
downloadmariadb-git-71d4ecf182642dbb9ec7c155d3b2606b8b1fb4a2.tar.gz
Merge 10.6 into 10.7
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 9d891ce413a..df94cac6475 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -5040,6 +5040,21 @@ bool check_table_name(const char *name, size_t length, bool check_for_path_chars
if (check_for_path_chars &&
(*name == '/' || *name == '\\' || *name == '~' || *name == FN_EXTCHAR))
return 1;
+ /*
+ We don't allow zero byte in table/schema names:
+ - Some code still uses NULL-terminated strings.
+ Zero bytes will confuse this code.
+ - There is a little practical use of zero bytes in names anyway.
+ Note, if the string passed as "name" comes here
+ from the parser as an identifier, it does not contain zero bytes,
+ as the parser rejects zero bytes in identifiers.
+ But "name" can also come here from queries like this:
+ SELECT * FROM I_S.TABLES WHERE TABLE_NAME='str';
+ In this case "name" is a general string expression
+ and it can have any arbitrary bytes, including zero bytes.
+ */
+ if (*name == 0x00)
+ return 1;
name++;
name_length++;
}