Below is the list of changes that have just been committed into a local
4.0 repository of heikki. When heikki does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.1299 02/09/21 18:47:56 heikki@xxxxxxxxxxxxxxx +1 -0
dict0dict.c:
Fix a crash introduced when we grew foreign key comment to 16000 chars
innobase/dict/dict0dict.c
1.22 02/09/21 18:47:48 heikki@xxxxxxxxxxxxxxx +26 -6
Fix a crash introduced when we grew foreign key comment to 16000 chars
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: heikki
# Host: hundin.mysql.fi
# Root: /home/heikki/mysql-4.0
--- 1.21/innobase/dict/dict0dict.c Wed Sep 4 20:01:08 2002
+++ 1.22/innobase/dict/dict0dict.c Sat Sep 21 18:47:48 2002
@@ -3109,7 +3109,7 @@
void
dict_print_info_on_foreign_keys_in_create_format(
/*=============================================*/
- char* buf, /* in: auxiliary buffer of 10000 chars */
+ char* buf, /* in: auxiliary buffer */
char* str, /* in/out: pointer to a string */
ulint len, /* in: space in str available for info */
dict_table_t* table) /* in: table */
@@ -3135,6 +3135,9 @@
buf2 += sprintf(buf2, ",\n FOREIGN KEY (");
for (i = 0; i < foreign->n_fields; i++) {
+ if ((ulint)(buf2 - buf) >= len) {
+ goto no_space;
+ }
buf2 += sprintf(buf2, "`%s`",
foreign->foreign_col_names[i]);
@@ -3157,6 +3160,9 @@
}
for (i = 0; i < foreign->n_fields; i++) {
+ if ((ulint)(buf2 - buf) >= len) {
+ goto no_space;
+ }
buf2 += sprintf(buf2, "`%s`",
foreign->referenced_col_names[i]);
if (i + 1 < foreign->n_fields) {
@@ -3176,7 +3182,7 @@
foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
}
-
+no_space:
mutex_exit(&(dict_sys->mutex));
buf[len - 1] = '\0';
@@ -3200,16 +3206,17 @@
dict_foreign_t* foreign;
ulint i;
char* buf2;
- char buf[10000];
+ char* buf;
+
+ buf = mem_alloc(len + 5000);
if (create_table_format) {
dict_print_info_on_foreign_keys_in_create_format(
buf, str, len, table);
+ mem_free(buf);
return;
}
- buf2 = buf;
-
mutex_enter(&(dict_sys->mutex));
foreign = UT_LIST_GET_FIRST(table->foreign_list);
@@ -3217,13 +3224,21 @@
if (foreign == NULL) {
mutex_exit(&(dict_sys->mutex));
+ mem_free(buf);
return;
}
+ buf2 = buf;
+
while (foreign != NULL) {
+
buf2 += sprintf(buf2, "; (");
for (i = 0; i < foreign->n_fields; i++) {
+ if ((ulint)(buf2 - buf) >= len) {
+ goto no_space;
+ }
+
buf2 += sprintf(buf2, "%s",
foreign->foreign_col_names[i]);
@@ -3236,6 +3251,9 @@
foreign->referenced_table_name);
for (i = 0; i < foreign->n_fields; i++) {
+ if ((ulint)(buf2 - buf) >= len) {
+ goto no_space;
+ }
buf2 += sprintf(buf2, "%s",
foreign->referenced_col_names[i]);
if (i + 1 < foreign->n_fields) {
@@ -3255,9 +3273,11 @@
foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
}
-
+no_space:
mutex_exit(&(dict_sys->mutex));
buf[len - 1] = '\0';
ut_memcpy(str, buf, len);
+
+ mem_free(buf);
}
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail internals-thread4779@xxxxxxxxxxxxxxx
To unsubscribe, e-mail <internals-unsubscribe@xxxxxxxxxxxxxxx>
|