Blame SOURCES/wireshark-1.10.14-CVE-2018-19622.patch

a65ffb
diff --git a/epan/dissectors/packet-mmse.c.old b/epan/dissectors/packet-mmse.c
a65ffb
index aacebaf..2a74836 100644
a65ffb
--- a/epan/dissectors/packet-mmse.c.old
a65ffb
+++ b/epan/dissectors/packet-mmse.c
a65ffb
@@ -494,6 +494,12 @@ get_value_length(tvbuff_t *tvb, guint offset, guint *byte_count)
a65ffb
 	field = tvb_get_guintvar(tvb, offset, byte_count);
a65ffb
 	(*byte_count)++;
a65ffb
     }
a65ffb
+
a65ffb
+    /* The packet says there are this many bytes; ensure they're there.
a65ffb
+     * We do this here because several callers do math on the length we
a65ffb
+     * return here and may not catch an overflow.
a65ffb
+     */
a65ffb
+    tvb_ensure_bytes_exist(tvb, offset, field);
a65ffb
     return field;
a65ffb
 }
a65ffb
 
a65ffb
@@ -699,7 +705,7 @@ static void
a65ffb
 dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut,
a65ffb
 	const char *message_type)
a65ffb
 {
a65ffb
-    guint	 offset;
a65ffb
+    guint	 offset, old_offset;
a65ffb
     guint8	 field = 0;
a65ffb
     const char	 *strval;
a65ffb
     guint	 length;
a65ffb
@@ -734,6 +740,7 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut,
a65ffb
     }
a65ffb
 
a65ffb
     offset = 2;			/* Skip Message-Type	*/
a65ffb
+    old_offset = 1;
a65ffb
 
a65ffb
     /*
a65ffb
      * Cycle through MMS-headers
a65ffb
@@ -1293,6 +1300,11 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut,
a65ffb
 		    break;
a65ffb
 	    }
a65ffb
 	    DebugLog(("\tEnd(case)\n"));
a65ffb
+
a65ffb
+            if (offset <= old_offset) {
a65ffb
+                REPORT_DISSECTOR_BUG("Offset isn't increasing");
a65ffb
+            }
a65ffb
+            old_offset = offset;
a65ffb
 	}
a65ffb
 	DebugLog(("\tEnd(switch)\n"));
a65ffb
 	if (field == MM_CTYPE_HDR) {