From 38a5b44d61cabf4ccda8adb89c94ae730f87d48c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Sat, 24 Jun 2023 21:05:34 +0100 Subject: dflter: Fix semantics of fvalue length Do not mix wire size, a protocol property, with fvalue length, a property of certain types of objects (sequences). Rename ftype_length() to ftype_wire_size(). Do not return wire_size with fvalue_length() (use ftype_wire_size() instead). Make the semantic check reject taking the len() of objects that are not arrays or lists. If the (fixed) len() of a number is somehow useful we can add a different function for that. --- epan/ftypes/ftype-ipv4.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'epan/ftypes/ftype-ipv4.c') diff --git a/epan/ftypes/ftype-ipv4.c b/epan/ftypes/ftype-ipv4.c index 9b02821d68..dc22944a0f 100644 --- a/epan/ftypes/ftype-ipv4.c +++ b/epan/ftypes/ftype-ipv4.c @@ -143,6 +143,12 @@ bitwise_and(fvalue_t *dst, const fvalue_t *fv_a, const fvalue_t *fv_b, char **er return FT_OK; } +static guint +len(fvalue_t *fv _U_) +{ + return 4; +} + static void slice(fvalue_t *fv, GByteArray *bytes, guint offset, guint length) { @@ -196,7 +202,7 @@ ftype_register_ipv4(void) ipv4_hash, is_zero, NULL, - NULL, + len, slice, bitwise_and, NULL, /* unary_minus */ -- cgit v1.2.3