From 0fbff063b8f2f6c45ec7604d079308a0b2d9e6cd Mon Sep 17 00:00:00 2001 From: Jim Monte Date: Sun, 28 Jul 2019 16:21:28 +0200 Subject: [PATCH] bug #408: prevent invalid data or crash by not reading beyond end of string --- src/frontend/parser/backq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/frontend/parser/backq.c b/src/frontend/parser/backq.c index e62378213..657d727db 100644 --- a/src/frontend/parser/backq.c +++ b/src/frontend/parser/backq.c @@ -44,7 +44,8 @@ cp_bquote(wordlist *wlist) *s++ = *t++; /* What the heck, let "echo `foo" work... */ *s = '\0'; - t++; /* Get past the second ` */ + if (*t != '\0') + t++; /* Get past the second ` */ if ((nwl = backeval(buf)) == NULL) { wlist->wl_word = NULL; return (wlist);