about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-16 13:25:05 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-16 13:25:05 -0400
commit0d5df2df4f57cf28adf91110f70cdee0bc830151 (patch)
treeb21b25ea25c58536d316dc8f03f7d622149422fa
parentbef7a85e45ccc4b40958ca6d94894ca0d27e8291 (diff)
downloadmusl-0d5df2df4f57cf28adf91110f70cdee0bc830151.tar.gz
musl-0d5df2df4f57cf28adf91110f70cdee0bc830151.tar.xz
musl-0d5df2df4f57cf28adf91110f70cdee0bc830151.zip
wordexp must set the we_offs entries of we_wordv to null pointers
-rw-r--r--src/misc/wordexp.c4
1 files changed, 4 insertions, 0 deletions
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;
 }