Commit 0750d88c authored by Chuck Bell's avatar Chuck Bell

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. 
parent f83839a4
...@@ -846,12 +846,19 @@ static int process_options(int argc, char *argv[], char *operation) ...@@ -846,12 +846,19 @@ static int process_options(int argc, char *argv[], char *operation)
{ {
i= (int)strlength(opt_basedir); i= (int)strlength(opt_basedir);
if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2) 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__ #ifdef __WIN__
if (opt_basedir[i-1] != '/') strncat(buff, "/", sizeof(buff) - 1);
strcat(opt_basedir, "//");
#else #else
strcat(opt_basedir, FN_DIRSEP); strncat(buff, FN_DIRSEP, sizeof(buff) - 1);
#endif #endif
buff[sizeof(buff) - 1]= 0;
my_delete(opt_basedir, MYF(0));
opt_basedir= my_strdup(buff, MYF(MY_FAE));
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment