mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-14 14:01:18 +02:00
18916: unsetting IFS could cause segfault
This commit is contained in:
parent
795d7872b6
commit
74678a3435
2 changed files with 11 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2003-08-01 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
|
* 18916: Src/utils.c: Unsetting IFS could cause segmentation
|
||||||
|
fault (any time IFS was used to join an array).
|
||||||
|
|
||||||
2003-07-31 Oliver Kiddle <opk@zsh.org>
|
2003-07-31 Oliver Kiddle <opk@zsh.org>
|
||||||
|
|
||||||
* 18914: Completion/Base/Utility/_nothing,
|
* 18914: Completion/Base/Utility/_nothing,
|
||||||
|
|
10
Src/utils.c
10
Src/utils.c
|
@ -2054,10 +2054,12 @@ sepjoin(char **s, char *sep, int heap)
|
||||||
if (!*s)
|
if (!*s)
|
||||||
return heap ? "" : ztrdup("");
|
return heap ? "" : ztrdup("");
|
||||||
if (!sep) {
|
if (!sep) {
|
||||||
sep = sepbuf;
|
p = sep = sepbuf;
|
||||||
sepbuf[0] = *ifs;
|
if (ifs) {
|
||||||
sepbuf[1] = *ifs == Meta ? ifs[1] ^ 32 : '\0';
|
*p++ = *ifs;
|
||||||
sepbuf[2] = '\0';
|
*p++ = *ifs == Meta ? ifs[1] ^ 32 : '\0';
|
||||||
|
}
|
||||||
|
*p = '\0';
|
||||||
}
|
}
|
||||||
sl = strlen(sep);
|
sl = strlen(sep);
|
||||||
for (t = s, l = 1 - sl; *t; l += strlen(*t) + sl, t++);
|
for (t = s, l = 1 - sl; *t; l += strlen(*t) + sl, t++);
|
||||||
|
|
Loading…
Reference in a new issue