dfilter: Fix handling of escaped quotes in macros

We can't unescape characters when expanding a display filter macro.
The escaping must be preserved until the expression is evaluated in
the display filter engine, otherwise it will likely generate a syntax
error in the parser.

In the macro body we allow '$' (or any other char) to be escaped
with backslash (preserving the backslash).

Fixes #17160.
This commit is contained in:
João Valverde 2021-05-26 04:17:59 +01:00 committed by Wireshark GitLab Utility
parent 8d60d8c4f2
commit 1dba58789d
1 changed files with 3 additions and 2 deletions

View File

@ -370,8 +370,9 @@ static gboolean macro_update(void* mp, gchar** error) {
*w = *r;
goto done;
case '\\':
*(w++) = *(++r);
r++;
*(w++) = *(r++);
if(*r)
*(w++) = *(r++);
break;
case '$': {
int cnt = 0;