mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-11 00:51:05 +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>
|
||||
|
||||
* 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)
|
||||
return heap ? "" : ztrdup("");
|
||||
if (!sep) {
|
||||
sep = sepbuf;
|
||||
sepbuf[0] = *ifs;
|
||||
sepbuf[1] = *ifs == Meta ? ifs[1] ^ 32 : '\0';
|
||||
sepbuf[2] = '\0';
|
||||
p = sep = sepbuf;
|
||||
if (ifs) {
|
||||
*p++ = *ifs;
|
||||
*p++ = *ifs == Meta ? ifs[1] ^ 32 : '\0';
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
sl = strlen(sep);
|
||||
for (t = s, l = 1 - sl; *t; l += strlen(*t) + sl, t++);
|
||||
|
|
Loading…
Reference in a new issue