summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2016-08-11 20:22:37 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2016-08-11 20:44:10 +0100
commit20fcb1e7be45177beca2d433f54260843cc7c2f6 (patch)
treefbb6624d5dfc33eea892ddf327f973942fcf5e16
parent8487aee9abc86726a0669eab24fce8ecade8f22b (diff)
Defensive coding in ${run }
Bug 1870
-rw-r--r--src/src/expand.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/src/expand.c b/src/src/expand.c
index 9cdf28fc1..c13284d8e 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -3189,16 +3189,17 @@ items. */
while (isspace(*s)) s++;
if (*s == '}')
{
- 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 (!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;
+ }
s++;
goto RETURN;
}
@@ -4959,7 +4960,10 @@ while (*s != 0)
}
if (skipping) /* Just pretend it worked when we're skipping */
+ {
runrc = 0;
+ lookup_value = NULL;
+ }
else
{
if (!transport_set_up_command(&argv, /* anchor for arg list */