Commit ff66bc05 authored by unknown's avatar unknown
Browse files

Applied InnoDB snapshot 5.1-ss927

Fixes:
- Bug #23368: crash during insert, table has foreign key pointing into other schema,permission


storage/innobase/dict/dict0dict.c:
  Applied InnoDB snapshot 5.1-ss927
  
  Revision r927:
  dict_print_info_on_foreign_key_in_create_format(): Use ut_print_name()
  instead of passing the wrong length to ut_print_namel().  (Bug #23368)
  
  ut_print_name(), ut_print_namel(): Document the special treatment of '/'.
  
  ut_print_namel(): Replace strchr() with memchr(), as the string might
  not be NUL-terminated.
storage/innobase/include/ut0ut.h:
  Applied InnoDB snapshot 5.1-ss927
  
  Revision r927:
  dict_print_info_on_foreign_key_in_create_format(): Use ut_print_name()
  instead of passing the wrong length to ut_print_namel().  (Bug #23368)
  
  ut_print_name(), ut_print_namel(): Document the special treatment of '/'.
  
  ut_print_namel(): Replace strchr() with memchr(), as the string might
  not be NUL-terminated.
storage/innobase/ut/ut0ut.c:
  Applied InnoDB snapshot 5.1-ss927
  
  Revision r927:
  dict_print_info_on_foreign_key_in_create_format(): Use ut_print_name()
  instead of passing the wrong length to ut_print_namel().  (Bug #23368)
  
  ut_print_name(), ut_print_namel(): Document the special treatment of '/'.
  
  ut_print_namel(): Replace strchr() with memchr(), as the string might
  not be NUL-terminated.
parent 5fda3c2c
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -4146,18 +4146,8 @@ dict_print_info_on_foreign_key_in_create_format(
			      dict_remove_db_name(
				      foreign->referenced_table_name));
	} else {
		/* Look for the '/' in the table name */

		i = 0;
		while (foreign->referenced_table_name[i] != '/') {
			i++;
		}

		ut_print_namel(file, trx, TRUE,
			       foreign->referenced_table_name, i);
		putc('.', file);
		ut_print_name(file, trx, TRUE,
			      foreign->referenced_table_name + i + 1);
			      foreign->referenced_table_name);
	}

	putc(' ', file);
+8 −2
Original line number Diff line number Diff line
@@ -218,7 +218,10 @@ ut_print_filename(
struct trx_struct;

/**************************************************************************
Outputs a NUL-terminated string, quoted as an SQL identifier. */
Outputs a fixed-length string, quoted as an SQL identifier.
If the string contains a slash '/', the string will be
output as two identifiers separated by a period (.),
as in SQL database_name.identifier. */

void
ut_print_name(
@@ -230,7 +233,10 @@ ut_print_name(
	const char*	name);	/* in: name to print */

/**************************************************************************
Outputs a fixed-length string, quoted as an SQL identifier. */
Outputs a fixed-length string, quoted as an SQL identifier.
If the string contains a slash '/', the string will be
output as two identifiers separated by a period (.),
as in SQL database_name.identifier. */

void
ut_print_namel(
+9 −3
Original line number Diff line number Diff line
@@ -394,7 +394,10 @@ ut_print_filename(
}

/**************************************************************************
Outputs a NUL-terminated string, quoted as an SQL identifier. */
Outputs a fixed-length string, quoted as an SQL identifier.
If the string contains a slash '/', the string will be
output as two identifiers separated by a period (.),
as in SQL database_name.identifier. */

void
ut_print_name(
@@ -409,7 +412,10 @@ ut_print_name(
}

/**************************************************************************
Outputs a fixed-length string, quoted as an SQL identifier. */
Outputs a fixed-length string, quoted as an SQL identifier.
If the string contains a slash '/', the string will be
output as two identifiers separated by a period (.),
as in SQL database_name.identifier. */

void
ut_print_namel(
@@ -424,7 +430,7 @@ ut_print_namel(
#ifdef UNIV_HOTBACKUP
	fwrite(name, 1, namelen, f);
#else
	char*	slash = strchr(name, '/');
	char*	slash = memchr(name, '/', namelen);

	if (UNIV_LIKELY_NULL(slash)) {
		/* Print the database name and table name separately. */