Defensive coding in ${run }
authorJeremy Harris <jgh146exb@wizmail.org>
Thu, 11 Aug 2016 19:22:37 +0000 (20:22 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Thu, 11 Aug 2016 19:44:10 +0000 (20:44 +0100)
Bug 1870

src/src/expand.c

index 9cdf28fc1f966f892e6159eecb704c57571c9ec1..c13284d8e78925c4053ef959ee62a700e2b8e209 100644 (file)
@@ -3189,16 +3189,17 @@ items. */
 while (isspace(*s)) s++;
 if (*s == '}')
   {
 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;
   }
   s++;
   goto RETURN;
   }
@@ -4959,7 +4960,10 @@ while (*s != 0)
        }
 
       if (skipping)   /* Just pretend it worked when we're skipping */
        }
 
       if (skipping)   /* Just pretend it worked when we're skipping */
+       {
         runrc = 0;
         runrc = 0;
+       lookup_value = NULL;
+       }
       else
         {
         if (!transport_set_up_command(&argv,    /* anchor for arg list */
       else
         {
         if (!transport_set_up_command(&argv,    /* anchor for arg list */