summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-15 11:55:38 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-15 11:55:38 +0000
commit8272394e7ec5cd12816d59f45eaf650dededa6f9 (patch)
treef3e2850095da7b87b54c2413771380e2027421b5
parent948262ba28b0667e27f59faeec6ac88cb7b22825 (diff)
downloadzsh-8272394e7ec5cd12816d59f45eaf650dededa6f9.tar.gz
zsh-8272394e7ec5cd12816d59f45eaf650dededa6f9.tar.xz
zsh-8272394e7ec5cd12816d59f45eaf650dededa6f9.zip
extra paranoia for empty prefix/suffix in completion matching (11374)
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/compcore.c8
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  <wischnow@zsh.org>
 
+	* 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