aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-10-15 17:09:22 +0100
committerJoão Valverde <j@v6e.pt>2021-10-15 17:29:34 +0100
commit06890ea379ee833fc15cc08023a153bb89741651 (patch)
tree540d491d151c548e6709ad6d3c0863a80fd614ef
parent6d4a4636206c4c0506466177cba1b5f04fa73e09 (diff)
dfilter: Forbid protocol filter names beginning with '-'
Reducing the namespace for protocol names makes the display filter grammar simpler and less ambiguous and error prone. We can't easily impose stricter restrictions without breaking backward compatibility but names starting with '-' are a pathological case because of negative numbers and byte slices and in the unlikely event that any such names exist they should be fixed.
-rw-r--r--epan/proto.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 8b906dd44c..0b7e66b9a0 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -7385,6 +7385,12 @@ check_valid_filter_name_or_fail(const char *filter_name)
ws_error("Protocol filter name \"%s\" is invalid because it is a reserved keyword."
" This might be caused by an inappropriate plugin or a development error.", filter_name);
}
+
+ /* First character cannot be '-'. */
+ if (filter_name[0] == '-') {
+ ws_error("Protocol filter name \"%s\" cannot begin with '-'."
+ " This might be caused by an inappropriate plugin or a development error.", filter_name);
+ }
}
int