mirror of
https://github.com/MariaDB/server.git
synced 2026-05-09 16:44:29 +02:00
Check for empty table/column names
mysql-test/t/create.test: Test for empty table/column name tests/grant.pl: More tests tests/grant.res: More tests
This commit is contained in:
parent
f3eb7fe0c3
commit
03b0df9481
6 changed files with 35 additions and 10 deletions
|
|
@ -1099,6 +1099,8 @@ bool check_db_name(char *name)
|
|||
bool check_table_name(const char *name, uint length)
|
||||
{
|
||||
const char *end= name+length;
|
||||
if (!length || length > NAME_LEN)
|
||||
return 1;
|
||||
|
||||
while (name != end)
|
||||
{
|
||||
|
|
@ -1122,6 +1124,8 @@ bool check_table_name(const char *name, uint length)
|
|||
|
||||
bool check_column_name(const char *name)
|
||||
{
|
||||
const char *start= name;
|
||||
|
||||
while (*name)
|
||||
{
|
||||
#if defined(USE_MB) && defined(USE_MB_IDENT)
|
||||
|
|
@ -1139,7 +1143,8 @@ bool check_column_name(const char *name)
|
|||
return 1;
|
||||
name++;
|
||||
}
|
||||
return 0;
|
||||
/* Error if empty or too long column name */
|
||||
return (name == start || (uint) (name - start) > NAME_LEN);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue