diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-08-28 08:41:51 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-08-28 08:41:51 +0000 |
commit | c0ea4d62c81f7480192b1f61649f82d064dcb716 (patch) | |
tree | 3ff9b3deb6c3c95aa536ef59db564e73f97f4b9b /Src/Zle | |
parent | 7806ece93122c27478d74d53518c75500c3a5749 (diff) | |
download | zsh-c0ea4d62c81f7480192b1f61649f82d064dcb716.tar.gz zsh-c0ea4d62c81f7480192b1f61649f82d064dcb716.tar.xz zsh-c0ea4d62c81f7480192b1f61649f82d064dcb716.zip |
handle possible NULL pointer returned from bufferwords() (15717)
Diffstat (limited to 'Src/Zle')
-rw-r--r-- | Src/Zle/zle_misc.c | 12 |
1 files changed, 6 insertions, 6 deletions
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); |