Ethereal-dev: [Ethereal-dev] Patch for packet-sip

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Heikki Vatiainen <hessu@xxxxxxxxx>
Date: Sat, 18 Nov 2000 18:29:02 +0200
dissect_sip() was incorrectly always calling the next level
dissector when tree was NULL.

Index: packet-sip.c
===================================================================
RCS file: /cvsroot/ethereal/packet-sip.c,v
retrieving revision 1.6
diff -u -r1.6 packet-sip.c
--- packet-sip.c	2000/11/16 07:35:38	1.6
+++ packet-sip.c	2000/11/18 16:19:20
@@ -92,6 +92,9 @@
                              tvb_format_text(tvb, 0, eol - strlen(" SIP/2.0")) :
                              tvb_format_text(tvb, strlen("SIP/2.0 "), eol - strlen("SIP/2.0 ")));
 
+        msg_offset = sip_get_msg_offset(tvb, offset);
+        if (msg_offset < 0) goto bad;
+
         if (tree) {
                 proto_item *ti, *th;
                 proto_tree *sip_tree, *hdr_tree;
@@ -104,8 +107,6 @@
                                     tvb_format_text(tvb, 0, eol));
 
                 offset = next_offset;
-                msg_offset = sip_get_msg_offset(tvb, offset);
-                if (msg_offset < 0) goto bad;
                 th = proto_tree_add_item(sip_tree, hf_msg_hdr, tvb, offset, msg_offset - offset, FALSE);
                 hdr_tree = proto_item_add_subtree(th, ett_sip_hdr);
 
@@ -119,7 +120,7 @@
                 offset += 2;  /* Skip the CRLF mentioned above */
        }
 
-        if (tvb_length_remaining(tvb, offset) > 0) {
+        if (tvb_length_remaining(tvb, msg_offset) > 0) {
                 next_tvb = tvb_new_subset(tvb, offset, -1, -1);
                 call_dissector(sdp_handle, next_tvb, pinfo, tree);
         }