From 8272394e7ec5cd12816d59f45eaf650dededa6f9 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Mon, 15 May 2000 11:55:38 +0000 Subject: [PATCH] extra paranoia for empty prefix/suffix in completion matching (11374) --- ChangeLog | 3 +++ Src/Zle/compcore.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6ca86bae..8c011d7cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ 2000-05-15 Sven Wischnowsky + * 11374: Src/Zle/compcore.c: extra paranoia for empty + prefix/suffix in completion matching + * 11368: Src/utils.c: fix for empty (s::) separator and strings with meta-characters 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