From: Rich Felker Date: Mon, 10 Dec 2018 03:20:15 +0000 (-0500) Subject: fix wordexp not to read past end of string ending with lone backslash X-Git-Tag: v1.1.21~22 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7c8454790080395bf5b27857a766b3468aa5ed98;p=oweals%2Fmusl.git fix wordexp not to read past end of string ending with lone backslash --- diff --git a/src/misc/wordexp.c b/src/misc/wordexp.c index d123cf75..db83a69f 100644 --- a/src/misc/wordexp.c +++ b/src/misc/wordexp.c @@ -42,7 +42,7 @@ static int do_wordexp(const char *s, wordexp_t *we, int flags) if (flags & WRDE_NOCMD) for (i=0; s[i]; i++) switch (s[i]) { case '\\': - if (!sq) i++; + if (!sq && !s[++i]) return WRDE_SYNTAX; break; case '\'': if (!dq) sq^=1;