From e90a512aa600580e25617d3a7763c5f0cd5bccd2 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 3 Jan 2017 14:43:41 +0000 Subject: 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 -. --- ChangeLog | 4 ++++ Src/pattern.c | 8 +------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3c9c5654..bec87b8ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2017-01-03 Peter Stephenson + * 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. diff --git a/Src/pattern.c b/Src/pattern.c index 1f2e94bd9..928790f45 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -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; } -- cgit v1.2.3