aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dfilter/dfilter.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-09-26 22:22:50 +0100
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-10-01 16:04:37 +0000
commitdb18865e5517484ed7ce3aebc2e8695d5bf7bedf (patch)
tree9f26806ce246b0cf4f987c541a196acc4aa784de /epan/dfilter/dfilter.c
parent487e2b6bc3c204559fa6502f06c33c2383cd5e90 (diff)
dfilter: Save token value to syntax tree
When parsing we save the token value to the syntax tree. This is useful for better error reporting. Use it to report an invalid entity for the slice operation. Before only the memory location was reported, which is not a good error message. Before: % dftest '"01:02:03:04"[0:3] == foo' Filter: ""01:02:03:04"[0:3] == foo" dftest: Range is not supported for entity <0x7f6c84017740> of type STRING After: % dftest '"01:02:03:04"[0:3] == foo' Filter: ""01:02:03:04"[0:3] == foo" dftest: Range is not supported for entity 01:02:03:04 of type STRING When creating a new node from an old one we need to copy the token value. Simple tokens such as RBRACKET, COMMA and COLON are not part of the AST and don't have an associated semantic value.
Diffstat (limited to 'epan/dfilter/dfilter.c')
-rw-r--r--epan/dfilter/dfilter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dfilter/dfilter.c b/epan/dfilter/dfilter.c
index e093668d88..84822b3924 100644
--- a/epan/dfilter/dfilter.c
+++ b/epan/dfilter/dfilter.c
@@ -311,7 +311,7 @@ dfilter_compile(const gchar *text, dfilter_t **dfp, gchar **err_msg)
df_set_extra(&state, scanner);
while (1) {
- df_lval = stnode_new(STTYPE_UNINITIALIZED, NULL);
+ df_lval = stnode_new(STTYPE_UNINITIALIZED, NULL, NULL);
token = df_lex(scanner);
/* Check for scanner failure */