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:
@ -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++)
|
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);
|
char* dest = MXS_MALLOC(size);
|
||||||
if (dest)
|
if (dest)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user