hush: small fix to last commit
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 17 Jul 2017 14:50:20 +0000 (16:50 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 17 Jul 2017 14:50:20 +0000 (16:50 +0200)
die_if_script() indeed dies only in scripts! Must handle the case where it continues.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/hush.c

index 836f3b83c708d3f916b79d14d2fce363beb89e91..c8356f4b8552745349bbe2742ff5994309374b4d 100644 (file)
@@ -5736,7 +5736,7 @@ static NOINLINE const char *expand_one_var(char **to_be_freed_pp, char *arg, cha
                                if (len < 0) /* bash compat */
                                        die_if_script("%s: substring expression < 0", var);
                        }
-                       if (len == 0 || !val || beg >= strlen(val)) {
+                       if (len <= 0 || !val || beg >= strlen(val)) {
  arith_err:
                                val = NULL;
                        } else {