Make dissector handle unexpected data better.

svn path=/trunk/; revision=28875
This commit is contained in:
Jaap Keuter 2009-06-28 16:39:31 +00:00
parent 789089dfd2
commit 98fa965a00
1 changed files with 9 additions and 9 deletions

View File

@ -435,7 +435,7 @@ dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
control_h = tvb_get_ntohs(tvb, newoffset);
newoffset += 2;
col_set_str(pinfo->cinfo, COL_INFO, match_strval(hiph_packet_type, pinfo_vals));
col_set_str(pinfo->cinfo, COL_INFO, val_to_str(hiph_packet_type, pinfo_vals, "Unknown"));
/* populate a tree in the second pane with the status of the link layer (i.e. none) */
if(tree) {
@ -534,7 +534,7 @@ dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti_tlv = proto_tree_add_uint_format(hip_tlv_tree, hf_hip_type, tvb,
offset, 4 + tlv_length_h, tlv_type_h,
"%s (type=%u, length=%u)",
match_strval(tlv_type_h, hip_param_vals),
val_to_str(tlv_type_h, hip_param_vals, "Unknown"),
tlv_type_h, tlv_length_h);
/* Parse value */
@ -720,7 +720,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
/* First Group ID*/
proto_tree_add_uint_format(t, hf_hip_tlv_dh_group_id, tvb, newoffset,
1, n, "%u (%s)", n,
match_strval(n, dh_group_id_vals));
val_to_str(n, dh_group_id_vals, "Unknown"));
/* First Public value len */
newoffset++;
pv_len = tvb_get_ntohs(tvb, newoffset);
@ -735,7 +735,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
newoffset += pv_len;
proto_tree_add_uint_format(t, hf_hip_tlv_dh_group_id, tvb, newoffset,
1, n, "%u (%s)", n,
match_strval(n, dh_group_id_vals));
val_to_str(n, dh_group_id_vals, "Unknown"));
/* Second Public value len */
newoffset += 1;
pv_len = tvb_get_ntohs(tvb, newoffset);
@ -758,7 +758,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
trans = tvb_get_ntohs(tvb, newoffset);
proto_tree_add_uint_format(t, hf_hip_tlv_trans_id, tvb,
newoffset, 2, trans, "%u (%s)", trans,
match_strval(trans, transform_id_vals));
val_to_str(trans, transform_id_vals, "Unknown"));
tlv_len -= 2;
newoffset += 2;
}
@ -771,7 +771,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
trans = tvb_get_ntohs(tvb, newoffset);
proto_tree_add_uint_format(t, hf_hip_tlv_trans_id, tvb,
newoffset, 2, trans, "%u (%s)", trans,
match_strval(trans, transform_id_vals));
val_to_str(trans, transform_id_vals, "Unknown"));
tlv_len -= 2;
newoffset += 2;
}
@ -788,7 +788,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
trans = tvb_get_ntohs(tvb, newoffset);
proto_tree_add_uint_format(t, hf_hip_tlv_nat_traversal_mode_id, tvb,
newoffset, 2, trans, "%u (%s)", trans,
match_strval(trans, mode_id_vals));
val_to_str(trans, mode_id_vals, "Unknown"));
tlv_len -= 2;
newoffset += 2;
}
@ -1010,7 +1010,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
reg_type = tvb_get_guint8(tvb, newoffset);
proto_tree_add_uint_format(t, hf_hip_tlv_reg_type, tvb,
newoffset, 1, reg_type, "%u (%s)", reg_type,
match_strval(reg_type, reg_type_vals));
val_to_str(reg_type, reg_type_vals, "Unknown"));
/* one byte per registration type */
tlv_len--;
newoffset++;
@ -1031,7 +1031,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
n = tvb_get_guint8(tvb, offset+4);
proto_tree_add_uint_format(t, hf_hip_tlv_sig_alg, tvb, newoffset, 1,
n, "%u (%s)", n,
match_strval(n, sig_alg_vals));
val_to_str(n, sig_alg_vals, "Unknown"));
newoffset++;
/* Signature */
proto_tree_add_item(t, hf_hip_tlv_sig, tvb, newoffset, tlv_len-1,