浏览代码

wordexp must set the we_offs entries of we_wordv to null pointers

Rich Felker 13 年之前
父节点
当前提交
0d5df2df4f
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/misc/wordexp.c

+ 4 - 0
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;
 }