diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2021-05-26 04:17:59 +0100 |
---|---|---|
committer | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2021-05-28 11:17:03 +0000 |
commit | 7308ab766b9e7d9fdc7a9e84470da7472fa3e30c (patch) | |
tree | dcceebadeec06c840701be5f4f23bd65aa804241 | |
parent | e6eb1d737038425ad06691a964a2d3e1bd7b7612 (diff) |
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.
(cherry picked from commit 1dba58789d7fbf6952d631774c94f63e2179d4d1)
-rw-r--r-- | epan/dfilter/dfilter-macro.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/epan/dfilter/dfilter-macro.c b/epan/dfilter/dfilter-macro.c index fbc819f092..82907bcb52 100644 --- a/epan/dfilter/dfilter-macro.c +++ b/epan/dfilter/dfilter-macro.c @@ -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; |