aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-giop.c
diff options
context:
space:
mode:
authorrbalint <rbalint@f5534014-38df-0310-8fa8-9805f1628bb7>2009-08-22 22:46:41 +0000
committerrbalint <rbalint@f5534014-38df-0310-8fa8-9805f1628bb7>2009-08-22 22:46:41 +0000
commit56210107a429711e6e961a898a5eccecfc865dbd (patch)
treeb4c03ce58cc7b9c88dfee32ecb118e7ff065572c /epan/dissectors/packet-giop.c
parent61fe9d1b62b77a8b3f039c5653dedac7a77a3b76 (diff)
From Frederic Peters (made endian-aware by me):
fixed segfault with some GIOP packets git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29509 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-giop.c')
-rw-r--r--epan/dissectors/packet-giop.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c
index 0f1514cf46..383d8513e7 100644
--- a/epan/dissectors/packet-giop.c
+++ b/epan/dissectors/packet-giop.c
@@ -1716,7 +1716,7 @@ static void giop_dump_collection(collection_data_t collection_type) {
* But skip a subdissector if it has been disabled in GUI "edit protocols".
*/
-static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset,
+static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 *offset,
MessageHeader *header, gchar *operation ) {
int i,len;
@@ -1728,6 +1728,19 @@ static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo,
if (len == 0)
return FALSE;
+
+ {
+ guint32 message_size;
+ gboolean stream_is_big_endian = is_big_endian (header);
+
+ if (stream_is_big_endian)
+ message_size = pntohl (header->message_size);
+ else
+ message_size = pletohl (header->message_size);
+
+ if (*offset > header->message_size)
+ return FALSE;
+ }
saved_proto = pinfo->current_proto;
for (i=0; i<len; i++) {