[Toybox] [PATCH 1/4] sh: fix bug in parameter substitution (with shortest path removal)
Alexander Holler
holler at ahsoftware.de
Sat Nov 5 00:10:27 PDT 2022
Avoid a core dump on the following snippet:
V="a.b"; V=${V%.*}
---
toys/pending/sh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/toys/pending/sh.c b/toys/pending/sh.c
index 529cc5c0..298bfbc0 100644
--- a/toys/pending/sh.c
+++ b/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));
}
}
--
2.25.1
More information about the Toybox
mailing list