MXS-1385: Fix truncation of script variables

The replacement of script variables now uses the maximum string length of
the original and replacement to make sure there's enough buffer space.
This commit is contained in:
Markus Mäkelä
2017-09-01 21:49:00 +03:00
parent d0ec6e3762
commit d7662a10af

View File

@ -217,7 +217,9 @@ bool externcmd_substitute_arg(EXTERNCMD* cmd, const char* match, const char* rep
{
for (int i = 0; cmd->argv[i] && rval; i++)
{
size_t size = strlen(cmd->argv[i]);
size_t size_orig = strlen(cmd->argv[i]);
size_t size_replace = strlen(replace);
size_t size = MXS_MAX(size_orig, size_replace);
char* dest = MXS_MALLOC(size);
if (dest)
{