[Toybox] [PATCH 2/2] sh: fix detection of the EOF of a HERE document

Alexander Holler holler at ahsoftware.de
Sun Nov 6 01:13:06 PST 2022


---
 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 ffe1fc00..aab64427 100644
--- a/toys/pending/sh.c
+++ b/toys/pending/sh.c
@@ -2944,7 +2944,7 @@ static int parse_line(char *line, struct sh_pipeline **ppl,
       arg = pl->arg+1+pl->here;
 
       // Match unquoted EOF.
-      for (s = line, end = arg->v[arg->c]; *end; s++) {
+      for (s = line, end = arg->v[arg->c]; *end; s++, end++) {
         s += strspn(s, "\\\"'");
         if (!*s || *s != *end) break;
       }
-- 
2.25.1



More information about the Toybox mailing list