diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Src/Modules/parameter.c | 6 | ||||
-rw-r--r-- | Src/Zle/zle_misc.c | 12 | ||||
-rw-r--r-- | Src/subst.c | 2 |
4 files changed, 16 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog index 0e146396d..6097f9093 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-08-28 Sven Wischnowsky <wischnow@zsh.org> + + * 15717: Src/subst.c, Src/Modules/parameter.c, + Src/Zle/zle_misc.c: handle possible NULL pointer returned from + bufferwords() + 2001-08-27 Wayne Davison <wayned@users.sourceforge.net> * 15713: Completion/Redhat/Command/_rpm: added package-specification diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c index fe44eafb3..23c868598 100644 --- a/Src/Modules/parameter.c +++ b/Src/Modules/parameter.c @@ -1105,9 +1105,9 @@ histwgetfn(Param pm) int i = addhistnum(curhist, -1, HIST_FOREIGN), iw; Histent he = gethistent(i, GETHIST_UPWARD); - ll = bufferwords(NULL, NULL, NULL); - for (n = firstnode(ll); n; incnode(n)) - pushnode(l, getdata(n)); + if ((ll = bufferwords(NULL, NULL, NULL))) + for (n = firstnode(ll); n; incnode(n)) + pushnode(l, getdata(n)); while (he) { for (iw = he->nwords - 1; iw >= 0; iw--) { diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c index 2a650af86..e24d0c08b 100644 --- a/Src/Zle/zle_misc.c +++ b/Src/Zle/zle_misc.c @@ -549,13 +549,13 @@ copyprevshellword(char **args) int i; char *p = NULL; - l = bufferwords(NULL, NULL, &i); + if ((l = bufferwords(NULL, NULL, &i))) + for (n = firstnode(l); n; incnode(n)) + if (!i--) { + p = getdata(n); + break; + } - for (n = firstnode(l); n; incnode(n)) - if (!i--) { - p = getdata(n); - break; - } if (p) { int len = strlen(p); diff --git a/Src/subst.c b/Src/subst.c index 0ef084106..8bd1a1ae3 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -1833,7 +1833,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) } else list = bufferwords(NULL, val, NULL); - if (!firstnode(list)) + if (!list || !firstnode(list)) val = dupstring(""); else if (!nextnode(firstnode(list))) val = getdata(firstnode(list)); |