logo       


bk commit into 4.0 tree: msg#00180

Subject: bk commit into 4.0 tree
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>




Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe