diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2003-08-01 09:57:32 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2003-08-01 09:57:32 +0000 |
commit | 854a4dc348025dc8044f1132e63561e4249a2f87 (patch) | |
tree | a5a8c3b24c633a0a66d445b291dcb96a79a7f5b3 | |
parent | 59f986694ee1c24b027bc9e56171d48d7ef46987 (diff) | |
download | zsh-854a4dc348025dc8044f1132e63561e4249a2f87.tar.gz zsh-854a4dc348025dc8044f1132e63561e4249a2f87.tar.xz zsh-854a4dc348025dc8044f1132e63561e4249a2f87.zip |
18916: unsetting IFS could cause segfault
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/utils.c | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index f6254fb00..3e28a6b5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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-24 Oliver Kiddle <opk@zsh.org> * 18900: Completion/Linux/Command/_iptables, diff --git a/Src/utils.c b/Src/utils.c index 292f9cc89..4a6c1d3f6 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -2029,10 +2029,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++); |