From: Rich Felker Date: Mon, 16 Apr 2012 17:25:05 +0000 (-0400) Subject: wordexp must set the we_offs entries of we_wordv to null pointers X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=0d5df2df4f57cf28adf91110f70cdee0bc830151;hp=bef7a85e45ccc4b40958ca6d94894ca0d27e8291;ds=sidebyside wordexp must set the we_offs entries of we_wordv to null pointers --- diff --git a/src/misc/wordexp.c b/src/misc/wordexp.c index 34fc900a..15adddbe 100644 --- a/src/misc/wordexp.c +++ b/src/misc/wordexp.c @@ -139,6 +139,10 @@ static int do_wordexp(const char *s, wordexp_t *we, int flags) we->we_wordv = wv; we->we_wordc = i; + + for (i=we->we_offs; i; i--) + we->we_wordv[i-1] = 0; + if (flags & WRDE_DOOFFS) we->we_wordc -= we->we_offs; return err; }