Browse Source

sh: fix bug in parameter substitution (with shortest path removal)

Avoid a core dump on the following snippet:
  V="a.b"; V=${V%.*}
Alexander Holler 1 year ago
parent
commit
3bc85530e1
1 changed files with 1 additions and 1 deletions
  1. 1 1
      toys/pending/sh.c

+ 1 - 1
toys/pending/sh.c

@@ -2122,7 +2122,7 @@ barf:
             }
 
             if (yy != -1) {
-              if (*delete && (*delete)->arg==ifs) ifs[yy] = 0;
+              if (delete && *delete && (*delete)->arg==ifs) ifs[yy] = 0;
               else push_arg(delete, ifs = xstrndup(ifs, yy));
             }
           }