forked from osmocom/wireshark
gRPC: Several bugfixes
1. fix returing new offset value dissect_grpc_message() is called with the offset to the message that needs to be parsed and returns new offset (e.g. offset to the next message in stream). Before this change length of the parsed message (including 5 bytes header) were returned which was incorrect and may lead to infinite loops. 2. fix reported length in case of invalid packet 3. fix typo in comment: "streaam" Change-Id: I577cdcc0203a87122a4d8d8c660f43295609e8aa Signed-off-by: Vladimir Rutsky <rutsky@google.com> Reviewed-on: https://code.wireshark.org/review/23843 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
5a99830e21
commit
561914bd20
|
@ -280,7 +280,7 @@ dissect_grpc_message(tvbuff_t *tvb, guint offset, guint length, packet_info *pin
|
|||
dissect_body_data(grpc_tree, pinfo, tvb, offset, message_length, TRUE, http2_path, is_request);
|
||||
}
|
||||
|
||||
return length;
|
||||
return offset + message_length;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -317,7 +317,7 @@ dissect_grpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
|
|||
/* remaining bytes are not enough for dissecting the message body */
|
||||
|
||||
proto_tree_add_expert_format(grpc_tree, pinfo, &ei_grpc_body_malformed, tvb, offset, -1,
|
||||
"Malformed message data: only %u bytes left, need at least %u bytes.", tvb_len - offset, GRPC_MESSAGE_HEAD_LEN);
|
||||
"Malformed message data: only %u bytes left, need at least %u bytes.", tvb_len - offset, GRPC_MESSAGE_HEAD_LEN + message_length);
|
||||
break;
|
||||
}
|
||||
proto_item_set_len(ti, message_length + GRPC_MESSAGE_HEAD_LEN);
|
||||
|
@ -326,7 +326,7 @@ dissect_grpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
|
|||
http2_path = http2_get_header_value(pinfo, HTTP2_HEADER_PATH, FALSE);
|
||||
is_request = (http2_path != NULL);
|
||||
|
||||
if (http2_path == NULL) { /* this reponse, so we get it from http2 request streaam */
|
||||
if (http2_path == NULL) { /* this reponse, so we get it from http2 request stream */
|
||||
http2_path = http2_get_header_value(pinfo, HTTP2_HEADER_PATH, TRUE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue