projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
initial version of mips (o32) port, based on work by Richard Pennington (rdp)
[musl]
/
src
/
misc
/
wordexp.c
diff --git
a/src/misc/wordexp.c
b/src/misc/wordexp.c
index
4609b99
..
15adddb
100644
(file)
--- a/
src/misc/wordexp.c
+++ b/
src/misc/wordexp.c
@@
-82,6
+82,8
@@
static int do_wordexp(const char *s, wordexp_t *we, int flags)
if (we->we_offs > SIZE_MAX/sizeof(void *)/4)
return WRDE_NOSPACE;
i += we->we_offs;
if (we->we_offs > SIZE_MAX/sizeof(void *)/4)
return WRDE_NOSPACE;
i += we->we_offs;
+ } else {
+ we->we_offs = 0;
}
if (pipe(p) < 0) return WRDE_NOSPACE;
}
if (pipe(p) < 0) return WRDE_NOSPACE;
@@
-136,7
+138,12
@@
static int do_wordexp(const char *s, wordexp_t *we, int flags)
}
we->we_wordv = wv;
}
we->we_wordv = wv;
- we->we_wordc = i - we->we_offs;
+ 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;
}
return err;
}