1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-29 17:31:02 +01:00

handle possible NULL pointer returned from bufferwords() (15717)

This commit is contained in:
Sven Wischnowsky 2001-08-28 08:41:51 +00:00
parent 7806ece931
commit c0ea4d62c8
4 changed files with 16 additions and 10 deletions

View file

@ -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

View file

@ -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--) {

View file

@ -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);

View file

@ -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));