mirror of
https://github.com/MariaDB/server.git
synced 2025-05-28 13:01:41 +03:00
MAX_FULL_NAME_LEN in InnoDB to address possible insufficient name buffer Bug #59312 Approved by Sunny Bains
This commit is contained in:
parent
317a6eafc8
commit
cd47d29d7a
@ -1,3 +1,13 @@
|
||||
2011-01-06 The InnoDB Team
|
||||
* row/row0merge.c:
|
||||
Fix Bug#59312 Examine MAX_FULL_NAME_LEN in InnoDB to address
|
||||
possible insufficient name buffer
|
||||
|
||||
2011-01-06 The InnoDB Team
|
||||
* dict/dict0dict.c, handler/ha_innodb.cc, handler/i_s.cc,
|
||||
include/univ.i:
|
||||
Fix Bug#58643 InnoDB: too long table name
|
||||
|
||||
2010-11-11 The InnoDB Team
|
||||
* thr/thr0loc.c, trx/trx0i_s.c:
|
||||
Fix Bug#57802 Empty ASSERTION parameter passed to the HASH_SEARCH macro
|
||||
|
@ -932,7 +932,7 @@ dict_table_rename_in_cache(
|
||||
dict_foreign_t* foreign;
|
||||
dict_index_t* index;
|
||||
ulint fold;
|
||||
char old_name[MAX_TABLE_NAME_LEN + 1];
|
||||
char old_name[MAX_FULL_NAME_LEN + 1];
|
||||
|
||||
ut_ad(table);
|
||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||
@ -944,7 +944,7 @@ dict_table_rename_in_cache(
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, "InnoDB: too long table name: '%s', "
|
||||
"max length is %d\n", table->name,
|
||||
MAX_TABLE_NAME_LEN);
|
||||
MAX_FULL_NAME_LEN);
|
||||
ut_error;
|
||||
}
|
||||
|
||||
@ -994,11 +994,11 @@ dict_table_rename_in_cache(
|
||||
ut_fold_string(old_name), table);
|
||||
|
||||
if (strlen(new_name) > strlen(table->name)) {
|
||||
/* We allocate MAX_TABLE_NAME_LEN+1 bytes here to avoid
|
||||
/* We allocate MAX_FULL_NAME_LEN + 1 bytes here to avoid
|
||||
memory fragmentation, we assume a repeated calls of
|
||||
ut_realloc() with the same size do not cause fragmentation */
|
||||
ut_a(strlen(new_name) <= MAX_TABLE_NAME_LEN);
|
||||
table->name = ut_realloc(table->name, MAX_TABLE_NAME_LEN + 1);
|
||||
ut_a(strlen(new_name) <= MAX_FULL_NAME_LEN);
|
||||
table->name = ut_realloc(table->name, MAX_FULL_NAME_LEN + 1);
|
||||
}
|
||||
memcpy(table->name, new_name, strlen(new_name) + 1);
|
||||
|
||||
|
@ -6009,6 +6009,16 @@ create_table_def(
|
||||
DBUG_RETURN(HA_ERR_GENERIC);
|
||||
}
|
||||
|
||||
/* MySQL does the name length check. But we do additional check
|
||||
on the name length here */
|
||||
if (strlen(table_name) > MAX_FULL_NAME_LEN) {
|
||||
push_warning_printf(
|
||||
(THD*) trx->mysql_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_TABLE_NAME,
|
||||
"InnoDB: Table Name or Database Name is too long");
|
||||
DBUG_RETURN(ER_TABLE_NAME);
|
||||
}
|
||||
|
||||
n_cols = form->s->fields;
|
||||
|
||||
/* We pass 0 as the space id, and determine at a lower level the space
|
||||
|
@ -579,16 +579,7 @@ fill_innodb_locks_from_cache(
|
||||
for (i = 0; i < rows_num; i++) {
|
||||
|
||||
i_s_locks_row_t* row;
|
||||
|
||||
/* note that the decoded database or table name is
|
||||
never expected to be longer than NAME_LEN;
|
||||
NAME_LEN for database name
|
||||
2 for surrounding quotes around database name
|
||||
NAME_LEN for table name
|
||||
2 for surrounding quotes around table name
|
||||
1 for the separating dot (.)
|
||||
9 for the #mysql50# prefix */
|
||||
char buf[2 * NAME_LEN + 14];
|
||||
char buf[MAX_FULL_NAME_LEN + 1];
|
||||
const char* bufend;
|
||||
|
||||
char lock_trx_id[TRX_ID_MAX_LEN + 1];
|
||||
|
@ -296,6 +296,18 @@ number does not include a terminating '\0'. InnoDB probably can handle
|
||||
longer names internally */
|
||||
#define MAX_TABLE_NAME_LEN 192
|
||||
|
||||
/* The maximum length of a database name. Like MAX_TABLE_NAME_LEN this is
|
||||
the MySQL's NAME_LEN, see check_and_convert_db_name(). */
|
||||
#define MAX_DATABASE_NAME_LEN MAX_TABLE_NAME_LEN
|
||||
|
||||
/* MAX_FULL_NAME_LEN defines the full name path including the
|
||||
database name and table name. In addition, 14 bytes is added for:
|
||||
2 for surrounding quotes around table name
|
||||
1 for the separating dot (.)
|
||||
9 for the #mysql50# prefix */
|
||||
#define MAX_FULL_NAME_LEN \
|
||||
(MAX_TABLE_NAME_LEN + MAX_DATABASE_NAME_LEN + 14)
|
||||
|
||||
/*
|
||||
UNIVERSAL TYPE DEFINITIONS
|
||||
==========================
|
||||
|
@ -2341,7 +2341,7 @@ row_merge_rename_tables(
|
||||
{
|
||||
ulint err = DB_ERROR;
|
||||
pars_info_t* info;
|
||||
char old_name[MAX_TABLE_NAME_LEN + 1];
|
||||
char old_name[MAX_FULL_NAME_LEN + 1];
|
||||
|
||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
||||
ut_ad(old_table != new_table);
|
||||
@ -2356,7 +2356,7 @@ row_merge_rename_tables(
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr, "InnoDB: too long table name: '%s', "
|
||||
"max length is %d\n", old_table->name,
|
||||
MAX_TABLE_NAME_LEN);
|
||||
MAX_FULL_NAME_LEN);
|
||||
ut_error;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user