diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2017-02-26 01:07:47 +0000 |
---|---|---|
committer | Phil Pennock <pdp@exim.org> | 2017-02-26 13:32:09 -0500 |
commit | 232874e8705380a0819d460d24c01476d69971be (patch) | |
tree | dbc7505948066482cd0993d9a96c928e5b494d5a | |
parent | d9841333e40c16d12df8190527a0ceba233f4c93 (diff) | |
download | exim4-232874e8705380a0819d460d24c01476d69971be.tar.gz |
Fix ${extract } corrupting an enclosing ${reduce } $value. Bug 2061
Broken-by: 20fcb1e7be45 - Bug 1870
(cherry picked from commit 9e09521e621d852ac4828f1865b4ccb01568d9ee)
Signed-off-by: Phil Pennock <pdp@exim.org>
-rw-r--r-- | src/src/expand.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/src/expand.c b/src/src/expand.c index 55fb0b875..2027eb84c 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) { |