1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 21:44:11 +01:00

19336: Src/Zle/compmatch.c: Bug with metafied characters in length of

completion prefix
This commit is contained in:
Peter Stephenson 2004-01-05 17:28:49 +00:00
parent 4274eca07f
commit 66329cbe4c
2 changed files with 16 additions and 1 deletions

@ -1,3 +1,11 @@
2004-01-05 Peter Stephenson <pws@csr.com>
* 19336: Src/Zle/compmatch.c: Matches were compared in length
treating Meta characters as ordinary characters. This could
result in a common prefix being truncated immediately after
the Meta. This generated an invalid metafied string which
could cause the shell to crash.
2004-01-05 Wayne Davison <wayned@users.sourceforge.net>
* zsh-users/6969: Src/builtin.c: made an eval of an empty string

@ -1584,8 +1584,15 @@ sub_match(Cmdata md, char *str, int len, int sfx)
if (check_cmdata(md, sfx))
return ret;
/*
* Look for a common prefix. Be careful not to include
* a widowed Meta in the prefix. If we do include metafied
* characters, at this stage we still need the overall length
* including Meta's as separate characters.
*/
for (l = 0, p = str, q = md->str;
l < len && l < md->len && p[ind] == q[ind];
l < len && l < md->len && p[ind] == q[ind]
&& (p[ind] != Meta || p[ind+1] == q[ind+1]);
l++, p += add, q += add);
if (l) {