summaryrefslogtreecommitdiff
path: root/client/mysql_plugin.c
diff options
context:
space:
mode:
authorChuck Bell <chuck.bell@oracle.com>2011-09-07 13:09:27 -0400
committerChuck Bell <chuck.bell@oracle.com>2011-09-07 13:09:27 -0400
commit5acc7cacae5be0153487092dc47869a07f70da14 (patch)
tree700a728ee317a35252d5ce2ad7e91389e01d0771 /client/mysql_plugin.c
parenta2dd614820c9bb01f4883c5c231b707509a15119 (diff)
downloadmariadb-git-5acc7cacae5be0153487092dc47869a07f70da14.tar.gz
BUG#12929345 : Execution aborts without any messages (Windows only)
This patch corrects an unsafe string concatenation for a Windows-specific code segment. The symptoms were, under certain conditions like specifying the location of my-print-defaults and the basedir, and run on a release build, the client would exit without printing any messages.
Diffstat (limited to 'client/mysql_plugin.c')
-rw-r--r--client/mysql_plugin.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c
index 267ede5447c..ec3dc64f0d8 100644
--- a/client/mysql_plugin.c
+++ b/client/mysql_plugin.c
@@ -846,12 +846,19 @@ static int process_options(int argc, char *argv[], char *operation)
{
i= (int)strlength(opt_basedir);
if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2)
+ {
+ char buff[FN_REFLEN];
+
+ strncpy(buff, opt_basedir, sizeof(buff) - 1);
#ifdef __WIN__
- if (opt_basedir[i-1] != '/')
- strcat(opt_basedir, "//");
+ strncat(buff, "/", sizeof(buff) - 1);
#else
- strcat(opt_basedir, FN_DIRSEP);
+ strncat(buff, FN_DIRSEP, sizeof(buff) - 1);
#endif
+ buff[sizeof(buff) - 1]= 0;
+ my_delete(opt_basedir, MYF(0));
+ opt_basedir= my_strdup(buff, MYF(MY_FAE));
+ }
}
/*