diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2017-02-26 01:07:47 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2017-02-26 13:22:31 +0000 |
commit | 9e09521e621d852ac4828f1865b4ccb01568d9ee (patch) | |
tree | f85eac21b73a8fecb2a4e8fd48b8d71c77f42be5 | |
parent | bdde22152c0f5ee3792e2f9eede54097e37dd763 (diff) |
Fix ${extract } corrupting an enclosing ${reduce } $value. Bug 2061
Broken-by: 20fcb1e7be45 - Bug 1870
-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 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) { |