if ((proceed = switch_regex_perform(argv[0], argv[1], &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
if (argc > 2) {
- len = strlen(argv[0]) * 3;
+ len = (strlen(argv[0]) + strlen(argv[2]) + 10) * proceed;
substituted = malloc(len);
switch_assert(substituted);
memset(substituted, 0, len);
if (argc > 0) {
uint32_t len;
subst_string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- len = (uint32_t) (strlen(pcre_obj->string) + strlen(subst_string) + 10);
+ len = (uint32_t) (strlen(pcre_obj->string) + strlen(subst_string) + 10) * pcre_obj->proceed;
substituted = malloc(len);
switch_assert(substituted != NULL);
switch_perform_substitution(pcre_obj->re, pcre_obj->proceed, subst_string, pcre_obj->string, substituted, len, pcre_obj->ovector);
char *func = (char *) switch_xml_attr_soft(action, "function");
if (strchr(pattern, '(') && strchr(adata, '$')) {
- len = (uint32_t) (strlen(data) + strlen(adata) + 10);
+ len = (uint32_t) (strlen(data) + strlen(adata) + 10) * proceed;
if (!(substituted = malloc(len))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
switch_regex_safe_free(re);