Add overflow check to fix
authorEvan Huus <eapache@gmail.com>
Thu, 18 Apr 2013 19:45:22 +0000 (19:45 -0000)
committerEvan Huus <eapache@gmail.com>
Thu, 18 Apr 2013 19:45:22 +0000 (19:45 -0000)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8464

Also add modelines.

svn path=/trunk/; revision=48919

epan/dissectors/packet-etch.c

index 1819654c7575e7981e0d967c4814f647d8311964..067d87fdeb5f8511d98aa1c6b7080545e709dea4 100644 (file)
@@ -444,6 +444,12 @@ read_length(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
   proto_tree_add_item(etch_tree, hf_etch_length, tvb, *offset,
                       length_of_array_length_type, ENC_BIG_ENDIAN);
   (*offset) += length_of_array_length_type;
+
+  if (*offset + length < *offset) {
+    /* overflow case
+     * https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8464 */
+    length = tvb_reported_length_remaining(tvb, *offset);
+  }
   return length;
 }
 
@@ -995,3 +1001,16 @@ void proto_reg_handoff_etch(void)
     read_hashed_symbols_from_dir(gbl_keytab_folder);
   }
 }
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 2
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=2 tabstop=8 expandtab:
+ * :indentSize=2:tabSize=8:noTabs=true:
+ */