forked from osmocom/wireshark
manolito: skip integer elements that have an invalid length
As we know the field's length, we can skip to the next field even if the length is invalid. There's no need to abort the dissection in this case. Change-Id: I855427ca07f38c3041018a2d7ed9dbc15f1e9bd7 Reviewed-on: https://code.wireshark.org/review/15483 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
This commit is contained in:
parent
c1214d2207
commit
495b74f481
|
@ -177,6 +177,7 @@ dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* diss
|
|||
4+length, str, "%s (%s): %s", (char*)field_name_str, longname, str);
|
||||
offset += length;
|
||||
} else if (dtype == MANOLITO_INTEGER) {
|
||||
gboolean len_ok = TRUE;
|
||||
guint64 n = 0;
|
||||
|
||||
/* integers can be up to 5 bytes */
|
||||
|
@ -197,11 +198,19 @@ dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* diss
|
|||
case 1:
|
||||
n = tvb_get_guint8(tvb, offset);
|
||||
break;
|
||||
|
||||
default:
|
||||
len_ok = FALSE;
|
||||
}
|
||||
|
||||
ti = proto_tree_add_uint64_format(manolito_tree, hf_manolito_integer, tvb, start,
|
||||
4+length, n, "%s (%s): %" G_GINT64_MODIFIER "u",
|
||||
(char*)field_name_str, longname, n);
|
||||
if (len_ok) {
|
||||
ti = proto_tree_add_uint64_format(manolito_tree, hf_manolito_integer, tvb, start,
|
||||
4+length, n, "%s (%s): %" G_GINT64_MODIFIER "u",
|
||||
(char*)field_name_str, longname, n);
|
||||
}
|
||||
else {
|
||||
/* XXX - expert info */
|
||||
}
|
||||
offset += length;
|
||||
} else {
|
||||
proto_tree_add_expert_format(manolito_tree, pinfo, &ei_manolito_type,
|
||||
|
|
Loading…
Reference in New Issue