Fix for bug 6449:
authorjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 21 Oct 2011 08:32:10 +0000 (08:32 +0000)
committerjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 21 Oct 2011 08:32:10 +0000 (08:32 +0000)
Last RTPS2 submessage could have zero as octets_to_next_header.

From me: coding style unused parameters.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39506 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-rtps2.c

index 9047afe091508f61e73102baf0b40c7a6f636f70..51c8a5cd0204d5f017d0f661c42d5496fc9b33e6 100644 (file)
@@ -5524,7 +5524,7 @@ static void dissect_PAD(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id) {
+                guint16 vendor_id _U_) {
   /* 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    * |   PAD         |X|X|X|X|X|X|X|E|      octetsToNextHeader       |
@@ -5533,7 +5533,7 @@ static void dissect_PAD(tvbuff_t *tvb,
   if (tree) {
     rtps_util_decode_flags(tree, tvb, offset + 1, flags, PAD_FLAGS);
 
-    if (octets_to_next_header != 0) {
+    if (NEXT_guint16(tvb, offset + 2, little_endian) != 0) {
       proto_tree_add_uint_format(tree,
                           hf_rtps_sm_octets_to_next_header,
                           tvb,
@@ -6302,7 +6302,7 @@ static void dissect_ACKNACK(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id ) {
+                guint16 vendor_id _U_) {
   /*
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -6435,7 +6435,7 @@ static void dissect_NACK_FRAG(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id ) {
+                guint16 vendor_id _U_) {
   /*
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -6556,7 +6556,7 @@ static void dissect_HEARTBEAT(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id) {
+                guint16 vendor_id _U_) {
   /*
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -6674,7 +6674,7 @@ static void dissect_HEARTBEAT_BATCH(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id) {
+                guint16 vendor_id _U_) {
 
 
   /*
@@ -6817,7 +6817,7 @@ static void dissect_HEARTBEAT_FRAG(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id) {
+                guint16 vendor_id _U_) {
   /*
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -6939,7 +6939,7 @@ static void dissect_GAP(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id) {
+                guint16 vendor_id _U_) {
   /*
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -7042,7 +7042,7 @@ static void dissect_INFO_TS(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id) {
+                guint16 vendor_id _U_) {
   /*
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -7112,7 +7112,7 @@ static void dissect_INFO_SRC(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id) {
+                guint16 vendor_id _U_) {
   /*
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -7237,7 +7237,7 @@ static void dissect_INFO_REPLY_IP4(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id) {
+                guint16 vendor_id _U_) {
   /*
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -7320,7 +7320,7 @@ static void dissect_INFO_DST(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id) {
+                guint16 vendor_id _U_) {
   /*
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -7389,7 +7389,7 @@ static void dissect_INFO_REPLY(tvbuff_t *tvb,
                 int octets_to_next_header,
                 proto_tree *tree,
                 char * info_summary_text,
-                guint16 G_GNUC_UNUSED vendor_id) {
+                guint16 vendor_id _U_) {
   /*
    * 0...2...........7...............15.............23...............31
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -8706,7 +8706,9 @@ static gboolean dissect_rtps(tvbuff_t *tvb,
     little_endian = ((flags & FLAG_E) != 0);
 
     /* octet-to-next-header */
-    octets_to_next_header  = NEXT_guint16(tvb, offset + 2, little_endian);
+    octets_to_next_header = NEXT_guint16(tvb, offset + 2, little_endian);
+    if (octets_to_next_header == 0)
+      octets_to_next_header = tvb_reported_length_remaining(tvb, offset + 4);
     next_submsg = offset + octets_to_next_header + 4;
 
     /* Set length of this item */