OSITP: do not call subdissector if there is no data
authorPeter Wu <peter@lekensteyn.nl>
Tue, 9 Oct 2018 19:25:35 +0000 (21:25 +0200)
committerAnders Broman <a.broman58@gmail.com>
Wed, 10 Oct 2018 04:04:20 +0000 (04:04 +0000)
None of the current heuristics dissectors for "cotp" accept the packet,
so just skip calling subdissectors if the packet is empty.

Change-Id: Ie26f05d472b4d184d5229ceab8b143a88cc921fc
Reviewed-on: https://code.wireshark.org/review/30103
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Émilio Gonzalez <egg997@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-ositp.c

index 47c691d5302faaa451a6bbb3936d159642eb3e60..1c3c7381e00a35baa4bdb6c4b7c734d777c5ee2a 100644 (file)
@@ -1576,19 +1576,21 @@ static int ositp_decode_CR_CC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
    * XXX - tell the subdissector that this is user data in a CR or
    * CC packet rather than a DT packet?
    */
-  next_tvb = tvb_new_subset_remaining(tvb, offset);
-  if (!uses_inactive_subset){
-    if (dissector_try_heuristic(cotp_heur_subdissector_list, next_tvb, pinfo,
-                                tree, &hdtbl_entry, NULL)) {
-      *subdissector_found = TRUE;
-    } else {
-      call_data_dissector(next_tvb, pinfo, tree);
+  if (tvb_captured_length_remaining(tvb, offset)) {
+    next_tvb = tvb_new_subset_remaining(tvb, offset);
+    if (!uses_inactive_subset){
+      if (dissector_try_heuristic(cotp_heur_subdissector_list, next_tvb, pinfo,
+                                  tree, &hdtbl_entry, NULL)) {
+        *subdissector_found = TRUE;
+      } else {
+        call_data_dissector(next_tvb, pinfo, tree);
+      }
     }
+    else
+      call_data_dissector( next_tvb, pinfo, tree);
+    offset += tvb_captured_length_remaining(tvb, offset);
+    /* we dissected all of the containing PDU */
   }
-  else
-    call_data_dissector( next_tvb, pinfo, tree);
-  offset += tvb_captured_length_remaining(tvb, offset);
-  /* we dissected all of the containing PDU */
 
   return offset;