From: Date: June 22 2006 4:36pm Subject: bk commit into 5.1 tree (knielsen:1.2211) BUG#20622 List-Archive: http://lists.mysql.com/commits/8079 X-Bug: 20622 Message-Id: Below is the list of changes that have just been committed into a local 5.1 repository of knielsen. When knielsen 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://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2211 06/06/22 16:36:10 knielsen@stripped +2 -0 BUG#20622: Fix one-byte buffer overrun in IM directory string handling. The problem was a call to convert_dirname() with a destination buffer that did not have room for the trailing slash added by that function. This could cause the instance manager to crash in some cases. server-tools/instance-manager/instance_options.cc 1.35 06/06/22 16:36:06 knielsen@stripped +7 -2 Fix buffer overrun. mysys/mf_dirname.c 1.14 06/06/22 16:36:06 knielsen@stripped +3 -1 Clarify in comments that convert_dirname destination must be larger than source to accomodate a trailing slash. # 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: knielsen # Host: rt.int.sifira.dk # Root: /usr/local/mysql/mysql-5.1-bug20622 --- 1.13/mysys/mf_dirname.c 2006-02-25 19:35:07 +01:00 +++ 1.14/mysys/mf_dirname.c 2006-06-22 16:36:06 +02:00 @@ -72,7 +72,9 @@ SYNPOSIS convert_dirname() - to Store result here + to Store result here. Must be at least of size + min(FN_REFLEN, strlen(from) + 1) to make room + for adding FN_LIBCHAR at the end. from Original filename. May be == to from_end Pointer at end of filename (normally end \0) --- 1.34/server-tools/instance-manager/instance_options.cc 2006-05-22 13:20:37 +02:00 +++ 1.35/server-tools/instance-manager/instance_options.cc 2006-06-22 16:36:06 +02:00 @@ -420,8 +420,13 @@ const char *tmp; char *end; - if (!mysqld_path.str && !(mysqld_path.str= strdup_root(&alloc, default_path))) - goto err; + if (!mysqld_path.str) + { + // Need one extra byte, as convert_dirname() adds a slash at the end. + if (!(mysqld_path.str= alloc_root(&alloc, strlen(default_path) + 2))) + goto err; + strcpy(mysqld_path.str, default_path); + } // it's safe to cast this to char* since this is a buffer we are allocating end= convert_dirname((char*)mysqld_path.str, mysqld_path.str, NullS);