occurrences) could cause a segfault if the corresponding $<n> was
expanded.
+JH/15 Fix argument parsing for ${run } expansion. Previously, when an argument
+ included a close-brace character (eg. it itself used an expansion) an
+ error occurred.
+
Exim version 4.96
-----------------
const uschar * arg, ** argv;
BOOL late_expand = TRUE;
- if ((expand_forbid & RDO_RUN) != 0)
+ if (expand_forbid & RDO_RUN)
{
expand_string_message = US"running a command is not permitted";
goto EXPAND_FAILED;
s++;
if (late_expand) /* this is the default case */
- { /*{*/
- int n = Ustrcspn(s, "}");
+ {
+ int n;
+ const uschar * t;
+ /* Locate the end of the args */
+ (void) expand_string_internal(s,
+ ESI_BRACE_ENDS | ESI_HONOR_DOLLAR | ESI_SKIPPING, &t, NULL, NULL);
+ n = t - s;
arg = flags & ESI_SKIPPING ? NULL : string_copyn(s, n);
s += n;
}
else
{
+ DEBUG(D_expand)
+ debug_printf_indent("args string for ${run} expand before split\n");
if (!(arg = expand_string_internal(s,
ESI_BRACE_ENDS | ESI_HONOR_DOLLAR | flags, &s, &resetok, NULL)))
goto EXPAND_FAILED;
for (int i = 0; argv[i]; i++)
{
+ DEBUG(D_expand) debug_printf_indent("arg %d\n", i);
+
/* Handle special fudge for passing an address list */
if (addr &&
return FALSE;
}
- if ( f.running_in_test_harness && is_tainted(expanded_arg)
+ if ( f.running_in_test_harness && is_tainted(expanded_arg)
&& Ustrcmp(etext, "queryprogram router") == 0)
{ /* hack, would be good to not need it */
DEBUG(D_transport)