diff options
-rw-r--r-- | src/modules/utils/path.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index 60b242db54..a7ac429900 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -369,6 +369,8 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) else if (!varStart)
length++;
}
+ if (varStart)
+ length += (p - varStart)+1;
XCHAR *result = (XCHAR *)mir_alloc(sizeof(XCHAR) * (length + 1));
XCHAR *q = result;
@@ -397,6 +399,12 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) *q++=*p;
}
+ if (varStart) {
+ size_t len = p - varStart + 1;
+ _xcsncpy(q, varStart-1, len);
+ q += len;
+ }
+
*q = 0;
return result;
|