From a7b52d26c435c35336ddc5ff93d5680e648345c8 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Dec 2020 12:38:03 +0100 Subject: hush: fix fallout from tweaking ${var:START:LEN} code function old new delta expand_one_var 2344 2353 +9 Signed-off-by: Denys Vlasenko --- shell/hush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shell/hush.c') diff --git a/shell/hush.c b/shell/hush.c index 6b8f1c88c..9403e1f6c 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -6617,7 +6617,7 @@ static NOINLINE int expand_one_var(o_string *output, int n, exp_word = p; p = strchr(p, SPECIAL_VAR_SYMBOL); *p = '\0'; - vallen = strlen(val); + vallen = val ? strlen(val) : 0; if (beg < 0) { /* negative beg counts from the end */ beg = (arith_t)vallen + beg; -- cgit v1.2.3