Don't create a protocol tree entry for the body of an NDMP request or
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 27 Dec 2003 04:01:17 +0000 (04:01 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 27 Dec 2003 04:01:17 +0000 (04:01 +0000)
reply if there isn't a body, just a header, so that we don't throw an
exception and mark the frame as malformed if the request or reply isn't
supposed to have a body.

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

packet-ndmp.c

index 9bf8bd38ce5a591c12bdde1a4b7f96fc944db9a3..f0ee37b8fadb645045e17e7467b26b9dbb78e0cb 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for NDMP dissection
  * 2001 Ronnie Sahlberg (see AUTHORS for email)
  *
- * $Id: packet-ndmp.c,v 1.24 2003/04/21 08:13:18 guy Exp $
+ * $Id: packet-ndmp.c,v 1.25 2003/12/27 04:01:17 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -2628,10 +2628,12 @@ dissect_ndmp_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
                return offset;
        }
 
-       if(tree){
-               cmd_item = proto_tree_add_text(tree, tvb, offset, -1,
-                       msg_vals[i].strptr);
-               cmd_tree = proto_item_add_subtree(cmd_item, ett_ndmp);
+       if (tvb_reported_length_remaining(tvb, offset) > 0) {
+               if(tree){
+                       cmd_item = proto_tree_add_text(tree, tvb, offset, -1,
+                               msg_vals[i].strptr);
+                       cmd_tree = proto_item_add_subtree(cmd_item, ett_ndmp);
+               }
        }
 
        if(nh->type==NDMP_MESSAGE_REQUEST){