diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2017-09-27 14:48:06 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2017-09-27 15:35:48 +0000 |
commit | 3d661f2fe5851cb84fd6953774bb71ee5071c597 (patch) | |
tree | 68bba1896eadb7864b7e287b9bb7f53fbb035908 /epan | |
parent | 6ab87ad77d735b753c81f7ce4f82dd2de03474d8 (diff) |
GRPC: fix character check (CID 1418526)
Change-Id: I998ca90149ec65529d79b294a6d00624858fc94a
Reviewed-on: https://code.wireshark.org/review/23763
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-grpc.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/epan/dissectors/packet-grpc.c b/epan/dissectors/packet-grpc.c index 140c912499..7c41a3dfa0 100644 --- a/epan/dissectors/packet-grpc.c +++ b/epan/dissectors/packet-grpc.c @@ -170,10 +170,11 @@ dissect_body_data(proto_tree *grpc_tree, packet_info *pinfo, tvbuff_t *tvb, cons if (grpc_detect_json_automatically && length > 3 && tvb_get_guint8(next_tvb, 0) == '{') /* start with '{' */ { - guint32 end_bytes = tvb_get_guint24(next_tvb, length - 3, ENC_BIG_ENDIAN); - if ((end_bytes & 0x0000FF) == '}' /* end with '}' */ - || (end_bytes & 0x00FF00) == '}' /* or "}\n" */ - || (end_bytes & 0xFF0000) == '}') /* or "}\n\r" or " }\r\n" */ + guint8 end_bytes[3]; + tvb_memcpy(next_tvb, end_bytes, length - 3, 3); + if (end_bytes[2] == '}' /* end with '}' */ + || end_bytes[1] == '}' /* or "}\n" */ + || end_bytes[0] == '}') /* or "}\n\r" or " }\r\n" */ { /* We just replace content-type with "application/grpc+json" insteadof calling JSON dissector directly. Because someone may want to use his own dissector to |