Wireshark-bugs: [Wireshark-bugs] [Bug 2890] New: tcp_dissect_pdu() is not passing correct buffer
Date: Mon, 22 Sep 2008 09:16:45 -0700 (PDT)

           Summary: tcp_dissect_pdu() is not passing correct buffer to
                    function that returns PDU length.
           Product: Wireshark
           Version: 1.0.2
          Platform: PC
        OS/Version: Red Hat
            Status: NEW
          Severity: Minor
          Priority: High
         Component: Wireshark
        AssignedTo: [email protected]
        ReportedBy: [email protected]

Build Information:
Paste the COMPLETE build information from "Help->About Wireshark", "wireshark
-v", or "tshark -v".
I am trying to implement dissector for my proprietary protocol. This protocol
can have more than 1 message in 1 TCP segment. I pass get_myprotocol_pdu_len()
to tcp_dissect_pdu() function. 

When there are 2 messages in 1 segment, this function is called twice. SO far
so good. First time tvb->real_data is pointing to 0xfirstpdu_start_addr. So far
so good. First PDU in this segment is handles correctly.

Now my_protocol_pdu_len() is called 2nd time to get 2nd pdu len but
tvb->real_data is still pointing to 0xfirstpdu_start_addr instead of start of
2nd pdu.

I fixed it in the following way.

--- packet-tcp.c.orig   2008-09-22 12:11:26.000000000 -0400
+++ packet-tcp.c        2008-09-22 12:11:27.000000000 -0400
@@ -1896,7 +1896,9 @@
      * Get the length of the PDU.
        old_plen = plen;
+       tvb->real_data = (char *)tvb->real_data + old_plen;
     plen = (*get_pdu_len)(pinfo, tvb, offset);
+       tvb->real_data = (char *)tvb->real_data - old_plen;
     if (plen < fixed_len) {
        * Either:

Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.