aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dfilter
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-05-09 08:17:32 +0000
committerGuy Harris <guy@alum.mit.edu>2004-05-09 08:17:32 +0000
commitaf3885bcf160d80c515ca6b71479ca9faabb45df (patch)
tree81bb28556662909a6db3e4013169b3962afdbe95 /epan/dfilter
parent09962ebb643c94d5cb6984c3ec7887ac81a8fc32 (diff)
From Graeme Hewson:
Error if protocol specified on RHS of display filter comparison. If user specified "fc", they probably intended a byte value rather than the fibre channel protocol; fix makes mistake clear. Fix assertion failure with range on LHS of display filter comparison and field on RHS. svn path=/trunk/; revision=10829
Diffstat (limited to 'epan/dfilter')
-rw-r--r--epan/dfilter/semcheck.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c
index a709c19600..6e01546292 100644
--- a/epan/dfilter/semcheck.c
+++ b/epan/dfilter/semcheck.c
@@ -1,5 +1,5 @@
/*
- * $Id: semcheck.c,v 1.25 2004/02/27 12:00:31 obiot Exp $
+ * $Id: semcheck.c,v 1.26 2004/05/09 08:17:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -647,7 +647,7 @@ check_relation_LHS_RANGE(const char *relation_string, FtypeCanFunc can_func _U_,
if (type2 == STTYPE_FIELD) {
DebugLog((" 5 check_relation_LHS_RANGE(type2 = STTYPE_FIELD)\n"));
- hfinfo2 = sttype_range_hfinfo(st_arg2);
+ hfinfo2 = stnode_data(st_arg2);
ftype2 = hfinfo2->type;
if (!is_bytes_type(ftype2)) {
@@ -724,8 +724,23 @@ check_relation(const char *relation_string, gboolean allow_partial_value,
#ifdef DEBUG_dfilter
static guint i = 0;
#endif
+header_field_info *hfinfo;
DebugLog((" 4 check_relation(\"%s\") [%u]\n", relation_string, i++));
+
+ /* Protocol can only be on LHS (for "contains" or "matches" operators).
+ * Check to see if protocol is on RHS. This catches the case where the
+ * user has written "fc" on the RHS, probably intending a byte value
+ * rather than the fibre channel protocol.
+ */
+
+ if (stnode_type_id(st_arg2) == STTYPE_FIELD) {
+ hfinfo = stnode_data(st_arg2);
+ if (hfinfo->type == FT_PROTOCOL)
+ dfilter_fail("Protocol (\"%s\") cannot appear on right-hand side of comparison.", hfinfo->abbrev);
+ THROW(TypeError);
+ }
+
switch (stnode_type_id(st_arg1)) {
case STTYPE_FIELD:
check_relation_LHS_FIELD(relation_string, can_func,