Wireshark mailing list archives

Re: tcp_dissect_pdus. get reassemble TCP


From: Siyang Xiong <siyangxiong2010 () gmail com>
Date: Wed, 17 Oct 2012 11:58:29 +0800

Hi,
I read the 2.7, and in my case i should use the 2nd method for
unpredictable length, However I still meet prblms:
in the code: (I add the bold comment)
static void dissect_cstr(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
tree)
  {
     guint offset = 0;
     while(offset < tvb_reported_length(tvb)) {
         gint available = tvb_reported_length_remaining(tvb, offset);
         gint len = tvb_strnlen(tvb, offset, available); //* I always get
-1 here*
*  *
         if( -1 == len ) {
             /* we ran out of data: ask for more */
             pinfo->desegment_offset = offset;
             pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
             return;
         }

         col_set_str(pinfo->cinfo, COL_INFO, "C String");

         len += 1; /* Add one for the '\0' */

         if (tree) {
             proto_tree_add_item(tree, hf_cstring, tvb, offset, len,
                                 ENC_ASCII|ENC_NA);
         }
         offset += (guint)len;
     }
 *    //I never reach here, cannot get the data.*
     /* if we get here, then the end of the tvb coincided with the end of a
        string. Happy days. */
  }
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: