1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-07-03 14:11:26 +02:00

40265: Fix problems with pure string in patterns with Meta.

Copy instead of relying on jiggery pokery with memory reallocation.

Problem was triggering with string ending with Dash converted to -.
This commit is contained in:
Peter Stephenson 2017-01-03 14:43:41 +00:00
parent 8d4c98540d
commit e90a512aa6
2 changed files with 5 additions and 7 deletions

View file

@ -1,5 +1,9 @@
2017-01-03 Peter Stephenson <p.stephenson@samsung.com>
* 40265: Src/pattern.c: fix continuing problems with Meta characters
in pattern that resolves to a string by copying source string.
Triggered by string that (correctly) turned Dash into '-'.
* Paulo Andrade: 40260: Src/prompt.c: Set newly allocated
space in prompt buffer to zero as it may be tested.

View file

@ -668,15 +668,9 @@ patcompile(char *exp, int inflags, char **endexp)
if (imeta(*mtest))
nmeta++;
if (nmeta) {
char *oldpatout = patout;
ptrdiff_t pd;
patadd(NULL, 0, nmeta, 0);
/*
* Yuk.
*/
p = (Patprog)patout;
pd = patout - oldpatout;
opnd += pd;
opnd = dupstring_wlen(opnd, oplen);
dst = patout + startoff;
}