X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmisc%2Fwordexp.c;h=617706e50d99c18f10eb9a85d836f6100abe63bc;hp=34fc900ac73e3ea928f111ecc098f1b15036eed2;hb=d75348ddda4e63c2a36c292a5b64b78d46e24422;hpb=bef7a85e45ccc4b40958ca6d94894ca0d27e8291 diff --git a/src/misc/wordexp.c b/src/misc/wordexp.c index 34fc900a..617706e5 100644 --- a/src/misc/wordexp.c +++ b/src/misc/wordexp.c @@ -139,11 +139,15 @@ 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; } -int wordexp(const char *s, wordexp_t *we, int flags) +int wordexp(const char *restrict s, wordexp_t *restrict we, int flags) { int r, cs; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);