1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug #53804: serious flaws in the alter database .. upgrade

data directory name command

The check_db_name function has been modified to validate tails of
#mysql50#-prefixed database names for compliance with MySQL 5.0
database name encoding rules (the check_table_name function call
has been reused).
This commit is contained in:
Gleb Shchepa
2010-05-21 22:47:32 +04:00
parent 836bb54c26
commit 6e34b8b0ce
7 changed files with 95 additions and 29 deletions

View File

@ -391,6 +391,25 @@ uint filename_to_tablename(const char *from, char *to, uint to_length)
}
/**
Check if given string begins with "#mysql50#" prefix
@param name string to check cut
@retval
FALSE no prefix found
@retval
TRUE prefix found
*/
bool check_mysql50_prefix(const char *name)
{
return (name[0] == '#' &&
!strncmp(name, MYSQL50_TABLE_NAME_PREFIX,
MYSQL50_TABLE_NAME_PREFIX_LENGTH));
}
/**
Check if given string begins with "#mysql50#" prefix, cut it if so.
@ -406,9 +425,7 @@ uint filename_to_tablename(const char *from, char *to, uint to_length)
uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length)
{
if (from[0] == '#' &&
!strncmp(from, MYSQL50_TABLE_NAME_PREFIX,
MYSQL50_TABLE_NAME_PREFIX_LENGTH))
if (check_mysql50_prefix(from))
return (uint) (strmake(to, from + MYSQL50_TABLE_NAME_PREFIX_LENGTH,
to_length - 1) - to);
return 0;