From 6250c0be4b56ca42b8b4db1d2b9d672811378dc0 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 25 Jun 2011 18:54:33 -0400 Subject: wordexp cannot use we_offs unless WRDE_DOOFFS flag is set previously, a potentially-indeterminate value from we_offs was being used, resulting in wrong we_wordc and subsequent crashes in the caller. --- src/misc/wordexp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/misc/wordexp.c b/src/misc/wordexp.c index 4609b99f..4a3efc7b 100644 --- a/src/misc/wordexp.c +++ b/src/misc/wordexp.c @@ -136,7 +136,8 @@ static int do_wordexp(const char *s, wordexp_t *we, int flags) } we->we_wordv = wv; - we->we_wordc = i - we->we_offs; + we->we_wordc = i; + if (flags & WRDE_DOOFFS) we->we_wordc -= we->we_offs; return err; } -- cgit v1.2.1