diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-10-21 13:41:04 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-10-21 13:41:04 +0300 |
commit | e4a7c15dd6ba812ac9a4183dec937513eb68a2bc (patch) | |
tree | 41954d8a6608a2309994d3bbe09f72c1cc73ce6f /sql/table.cc | |
parent | 1388845e048011932a6d715936a781479c5e6af3 (diff) | |
parent | 1a2308d3f443d8fcacf5506cb96f802dee3a3519 (diff) | |
download | mariadb-git-e4a7c15dd6ba812ac9a4183dec937513eb68a2bc.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc index e4501870a2b..ccc336962b6 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4298,6 +4298,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++; } |