FS-8185: [core] Allow xml preprocessor to expand variables where the resulting value is much longer than the original size

This commit is contained in:
Michael Jerris 2015-09-17 22:04:19 -05:00
parent 1b60510130
commit d8e7897f1e
1 changed files with 12 additions and 2 deletions

View File

@ -1254,6 +1254,11 @@ static char *expand_vars(char *buf, char *ebuf, switch_size_t elen, switch_size_
*wp++ = *rp++;
}
if (wp == ep) {
return NULL;
}
*wp++ = '\0';
*newlen = strlen(ebuf);
@ -1398,7 +1403,12 @@ static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rle
ebuf = malloc(eblen);
memset(ebuf, 0, eblen);
bp = expand_vars(buf, ebuf, eblen, &cur, &err);
while (!(bp = expand_vars(buf, ebuf, eblen, &cur, &err))) {
eblen *= 2;
ebuf = realloc(ebuf, eblen);
memset(ebuf, 0, eblen);
}
line++;
if (err) {