bug #408: prevent invalid data or crash by not reading beyond end of string

This commit is contained in:
Jim Monte 2019-07-28 16:21:28 +02:00 committed by Holger Vogt
parent 30565e45c4
commit 0fbff063b8
1 changed files with 2 additions and 1 deletions

View File

@ -44,7 +44,8 @@ cp_bquote(wordlist *wlist)
*s++ = *t++; *s++ = *t++;
/* What the heck, let "echo `foo" work... */ /* What the heck, let "echo `foo" work... */
*s = '\0'; *s = '\0';
t++; /* Get past the second ` */ if (*t != '\0')
t++; /* Get past the second ` */
if ((nwl = backeval(buf)) == NULL) { if ((nwl = backeval(buf)) == NULL) {
wlist->wl_word = NULL; wlist->wl_word = NULL;
return (wlist); return (wlist);