whois,finger: fix retval, convert from tvb_length

Fixes dissector bug:
failed assertion "save_desegment_offset == pinfo->desegment_offset &&
save_desegment_len == pinfo->desegment_len"

Change-Id: Ia475bea3726252530189a05ba4dbf69f3c2b7e6c
Reviewed-on: https://code.wireshark.org/review/2886
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
Peter Wu 2014-07-04 17:28:46 +02:00 committed by Evan Huus
parent 5bfc21cf9e
commit 49bc1047be
2 changed files with 8 additions and 8 deletions

View File

@ -78,14 +78,14 @@ dissect_finger(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
conversation_add_proto_data(conversation, proto_finger, finger_trans);
}
len = tvb_length(tvb);
len = tvb_reported_length(tvb);
if (!PINFO_FD_VISITED(pinfo)) {
if (pinfo->can_desegment) {
if (is_query) {
if ((len < 2) || (tvb_memeql(tvb, len - 2, "\r\n", 2))) {
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
pinfo->desegment_offset = 0;
return (0);
return -1;
} else {
finger_trans->req_frame = pinfo->fd->num;
finger_trans->req_time = pinfo->fd->abs_ts;
@ -93,7 +93,7 @@ dissect_finger(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
} else {
pinfo->desegment_len = DESEGMENT_UNTIL_FIN;
pinfo->desegment_offset = 0;
return (0);
return -1;
}
}
} else if (is_query && (finger_trans->req_frame == 0)) {
@ -147,7 +147,7 @@ dissect_finger(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
}
return (len);
return tvb_captured_length(tvb);
}
void

View File

@ -78,14 +78,14 @@ dissect_whois(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
conversation_add_proto_data(conversation, proto_whois, whois_trans);
}
len = tvb_length(tvb);
len = tvb_reported_length(tvb);
if (!PINFO_FD_VISITED(pinfo)) {
if (pinfo->can_desegment) {
if (is_query) {
if ((len < 2) || (tvb_memeql(tvb, len - 2, "\r\n", 2))) {
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
pinfo->desegment_offset = 0;
return (0);
return -1;
} else {
whois_trans->req_frame = pinfo->fd->num;
whois_trans->req_time = pinfo->fd->abs_ts;
@ -93,7 +93,7 @@ dissect_whois(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
} else {
pinfo->desegment_len = DESEGMENT_UNTIL_FIN;
pinfo->desegment_offset = 0;
return (0);
return -1;
}
}
} else if (is_query && (whois_trans->req_frame == 0)) {
@ -148,7 +148,7 @@ dissect_whois(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
}
return (len);
return tvb_captured_length(tvb);
}
void