From: Jeremy Harris Date: Sun, 26 Feb 2017 01:07:47 +0000 (+0000) Subject: Fix ${extract } corrupting an enclosing ${reduce } $value. Bug 2061 X-Git-Tag: exim-4_90_RC1~250 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9e09521e621d852ac4828f1865b4ccb01568d9ee;p=exim.git Fix ${extract } corrupting an enclosing ${reduce } $value. Bug 2061 Broken-by: 20fcb1e7be45 - Bug 1870 --- diff --git a/src/src/expand.c b/src/src/expand.c index 6257c28b7..f85ee494e 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -3194,17 +3194,17 @@ items. */ while (isspace(*s)) s++; if (*s == '}') { - if (!skipping) - if (type[0] == 'i') - { - if (yes) *yieldptr = string_catn(*yieldptr, sizeptr, ptrptr, US"true", 4); - } - else - { - if (yes && lookup_value) - *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value); - lookup_value = save_lookup; - } + if (type[0] == 'i') + { + if (yes && !skipping) + *yieldptr = string_catn(*yieldptr, sizeptr, ptrptr, US"true", 4); + } + else + { + if (yes && lookup_value && !skipping) + *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value); + lookup_value = save_lookup; + } s++; goto RETURN; } @@ -5801,11 +5801,12 @@ while (*s != 0) processing for real, we perform the iteration. */ if (skipping) continue; - while ((iterate_item = string_nextinlist(&list, &sep, NULL, 0)) != NULL) + while ((iterate_item = string_nextinlist(&list, &sep, NULL, 0))) { *outsep = (uschar)sep; /* Separator as a string */ - DEBUG(D_expand) debug_printf_indent("%s: $item = \"%s\"\n", name, iterate_item); + DEBUG(D_expand) debug_printf_indent("%s: $item = '%s' $value = '%s'\n", + name, iterate_item, lookup_value); if (item_type == EITEM_FILTER) {