diff options
author | Vladimir Rutsky <rutsky@google.com> | 2017-10-05 11:09:03 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-10-05 16:18:27 +0000 |
commit | 561914bd20913407f6344e4081c2e483d3e53bc4 (patch) | |
tree | ff14fb3ae6cd87e1be4438a30acacf745a6003e5 /epan | |
parent | 5a99830e211901e498e036b9adb00b0c33c7904d (diff) |
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>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-grpc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/dissectors/packet-grpc.c b/epan/dissectors/packet-grpc.c index 7c41a3dfa0..86813985c4 100644 --- a/epan/dissectors/packet-grpc.c +++ b/epan/dissectors/packet-grpc.c @@ -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); } |