Fix IP Security option dissection

"offset" no longer needed (since using dissector table for options),
and since it should always be 0, just remove it.

Change-Id: Icc2802b76bc99a17d60d1deff75e1dc65761e8ed
Reviewed-on: https://code.wireshark.org/review/22848
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2017-07-29 18:47:15 -04:00
parent c50945989d
commit e3b46bc48a
1 changed files with 4 additions and 5 deletions

View File

@ -859,8 +859,7 @@ dissect_ipopt_security(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
proto_item *tf;
guint val;
guint curr_offset = 2;
guint offset = 2,
optlen = tvb_reported_length(tvb);
guint optlen = tvb_reported_length(tvb);
field_tree = ip_var_option_header(tree, pinfo, tvb, proto_ip_option_security, ett_ip_option_sec, &tf, optlen);
@ -888,7 +887,7 @@ dissect_ipopt_security(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
/* Dissect as RFC 108 */
proto_tree_add_item(field_tree, hf_ip_opt_sec_cl, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
curr_offset++;
if ((curr_offset - offset) >= optlen) {
if (curr_offset >= optlen) {
return curr_offset;
}
val = tvb_get_guint8(tvb, curr_offset);
@ -897,7 +896,7 @@ dissect_ipopt_security(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
ENC_BIG_ENDIAN);
curr_offset++;
while (val & 0x01) {
if ((val & 0x01) && ((curr_offset - offset) == optlen)) {
if ((val & 0x01) && (curr_offset == optlen)) {
expert_add_info(pinfo, tf, &ei_ip_opt_sec_prot_auth_fti);
break;
}
@ -907,7 +906,7 @@ dissect_ipopt_security(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
ENC_BIG_ENDIAN);
curr_offset++;
}
if ((curr_offset - offset) < optlen) {
if (curr_offset < optlen) {
expert_add_info(pinfo, tf, &ei_ip_extraneous_data);
}