diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-05-15 11:55:38 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-05-15 11:55:38 +0000 |
commit | 8272394e7ec5cd12816d59f45eaf650dededa6f9 (patch) | |
tree | f3e2850095da7b87b54c2413771380e2027421b5 /Src | |
parent | 948262ba28b0667e27f59faeec6ac88cb7b22825 (diff) | |
download | zsh-8272394e7ec5cd12816d59f45eaf650dededa6f9.tar.gz zsh-8272394e7ec5cd12816d59f45eaf650dededa6f9.tar.xz zsh-8272394e7ec5cd12816d59f45eaf650dededa6f9.zip |
extra paranoia for empty prefix/suffix in completion matching (11374)
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Zle/compcore.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index e8ea28400..4608b16d4 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -1739,7 +1739,7 @@ addmatches(Cadata dat, char **argv) llpl -= gfl; } } - s = dat->ppre ? dat->ppre : ""; + s = dat->ppre ? dat->ppre : dupstring(""); if ((ml = match_str(lpre, s, &bpl, 0, NULL, 0, 0, 1)) >= 0) { if (matchsubs) { Cline tmp = get_cline(NULL, 0, NULL, 0, NULL, 0, 0); @@ -1757,14 +1757,14 @@ addmatches(Cadata dat, char **argv) bpadd = strlen(s) - ml; } else { if (llpl <= lpl && strpfx(lpre, s)) - lpre = ""; + lpre = dupstring(""); else if (llpl > lpl && strpfx(s, lpre)) lpre += lpl; else *argv = NULL; bcp = lpl; } - s = dat->psuf ? dat->psuf : ""; + s = dat->psuf ? dat->psuf : dupstring(""); if ((ml = match_str(lsuf, s, &bsl, 0, NULL, 1, 0, 1)) >= 0) { if (matchsubs) { Cline tmp = get_cline(NULL, 0, NULL, 0, NULL, 0, CLF_SUF); @@ -1782,7 +1782,7 @@ addmatches(Cadata dat, char **argv) bsadd = strlen(s) - ml; } else { if (llsl <= lsl && strsfx(lsuf, s)) - lsuf = ""; + lsuf = dupstring(""); else if (llsl > lsl && strsfx(s, lsuf)) lsuf[llsl - lsl] = '\0'; else |