Use tvb_memeql() and tvb_memcpy().
authorJeff Morriss <jeff.morriss@ulticom.com>
Sun, 16 Jan 2011 03:35:29 +0000 (03:35 -0000)
committerJeff Morriss <jeff.morriss@ulticom.com>
Sun, 16 Jan 2011 03:35:29 +0000 (03:35 -0000)
Use tvb_ip_to_str() and tvb_ip6_to_str().

There's no need to pass the result of tvb_get_ptr() as the 'value' in
proto_tree_add_*(): just use proto_tree_add_item().

Replace some tvb_get_ptr()s with tvb_get_ephemeral_string()s to ensure the
return string is NULL terminated.

svn path=/trunk/; revision=35546

14 files changed:
epan/dissectors/packet-btobex.c
epan/dissectors/packet-cms.c
epan/dissectors/packet-cops.c
epan/dissectors/packet-dcc.c
epan/dissectors/packet-dcm.c
epan/dissectors/packet-dsi.c
epan/dissectors/packet-dtpt.c
epan/dissectors/packet-echo.c
epan/dissectors/packet-fcip.c
epan/dissectors/packet-gsm_a_gm.c
epan/dissectors/packet-gsm_map.c
epan/dissectors/packet-ipsi-ctl.c
epan/dissectors/packet-iscsi.c
epan/dissectors/packet-ldp.c

index 2c807916ac846214d08c4da17ac5224363ca1384..0c6d285161bf22adab014b1a82d4fae6b025b437 100644 (file)
@@ -312,7 +312,6 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo)
        proto_item *handle_item;
        gint item_length = -1;
        guint8 hdr_id, i;
-       const guint8 *ptr;
 
        if(tvb_length_remaining(tvb, offset)>0) {
                hdrs = proto_tree_add_text(tree, tvb, offset, item_length, "Headers");
@@ -376,9 +375,8 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo)
                                handle_item = proto_tree_add_item(hdr_tree, hf_hdr_val_byte_seq, tvb, offset, item_length - 3, FALSE);
 
                                if( ((hdr_id == 0x46) || (hdr_id == 0x4a)) && (item_length == 19) ) { /* target or who */
-                                       ptr = tvb_get_ptr(tvb, offset, item_length - 3);
                                        for( i=0; target_vals[i].strptr != NULL; i++) {
-                                               if( memcmp(ptr, target_vals[i].value, 16) == 0 ) {
+                                               if( tvb_memeql(tvb, offset, target_vals[i].value, 16) == 0 ) {
                                                        proto_item_append_text(handle_item, ": %s", target_vals[i].strptr);
                                                        proto_item_append_text(hdr_tree, " (%s)", target_vals[i].strptr);
                                                        col_append_fstr(pinfo->cinfo, COL_INFO, " - %s", target_vals[i].strptr);
@@ -394,8 +392,8 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo)
                                }
                                else if(is_ascii_str(tvb_get_ptr(tvb, offset,item_length - 3), item_length - 3))
                                {
-                                       proto_item_append_text(hdr_tree, " (\"%s\")", tvb_get_ptr(tvb, offset,item_length - 3));
-                                       col_append_fstr(pinfo->cinfo, COL_INFO, " \"%s\"", tvb_get_ptr(tvb, offset,item_length - 3));
+                                       proto_item_append_text(hdr_tree, " (\"%s\")", tvb_get_ephemeral_string(tvb, offset,item_length - 3));
+                                       col_append_fstr(pinfo->cinfo, COL_INFO, " \"%s\"", tvb_get_ephemeral_string(tvb, offset,item_length - 3));
                                }
 
                                offset += item_length - 3;
@@ -724,7 +722,7 @@ proto_reg_handoff_btobex(void)
 
        btobex_handle = find_dissector("btobex");
 
-       /* register in rfcomm and l2cap the profiles/services this dissector should handle */ 
+       /* register in rfcomm and l2cap the profiles/services this dissector should handle */
        dissector_add_uint("btrfcomm.service", BTSDP_OPP_SERVICE_UUID, btobex_handle);
        dissector_add_uint("btrfcomm.service", BTSDP_FTP_SERVICE_UUID, btobex_handle);
        dissector_add_uint("btrfcomm.service", BTSDP_BPP_SERVICE_UUID, btobex_handle);
@@ -754,7 +752,7 @@ proto_reg_handoff_btobex(void)
        dissector_add_uint("btl2cap.service", BTSDP_MAP_SERVICE_UUID, btobex_handle);
        dissector_add_uint("btl2cap.service", BTSDP_MAP_ACCESS_SRV_SERVICE_UUID, btobex_handle);
        dissector_add_uint("btl2cap.service", BTSDP_MAP_NOIYFY_SRV_SERVICE_UUID, btobex_handle);
-       
+
        xml_handle = find_dissector("xml");
        data_handle = find_dissector("data");
 }
index 0020bfd06fc8fce0154079a67e7cd020d7ea37a8..8308ccb0a965b269b36c25583c413310236a0170 100644 (file)
@@ -314,7 +314,7 @@ cms_verify_msg_digest(proto_item *pi, tvbuff_t *content, const char *alg, tvbuff
     /* compare our computed hash with what we have received */
 
     if(tvb_bytes_exist(tvb, offset, buffer_size) &&
-       (memcmp(tvb_get_ptr(tvb, offset, buffer_size), digest_buf, buffer_size) != 0)) {
+       (tvb_memeql(tvb, offset, digest_buf, buffer_size) != 0)) {
       proto_item_append_text(pi, " [incorrect, should be ");
       for(i = 0; i < buffer_size; i++)
        proto_item_append_text(pi, "%02X", digest_buf[i]);
@@ -342,9 +342,9 @@ dissect_cms_ContentType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
          offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
 
 
-       if(object_identifier_id) {  
+       if(object_identifier_id) {
                name = oid_resolved_from_string(object_identifier_id);
-               proto_item_append_text(tree, " (%s)", name ? name : object_identifier_id); 
+               proto_item_append_text(tree, " (%s)", name ? name : object_identifier_id);
        }
 
 
@@ -439,7 +439,7 @@ dissect_cms_T_eContent(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
   proto_item_set_text(actx->created_item, "eContent (%u bytes)", tvb_length (content_tvb));
 
   call_ber_oid_callback(object_identifier_id, content_tvb, 0, actx->pinfo, top_tree ? top_tree : tree);
-  
+
 
 
   return offset;
@@ -472,7 +472,7 @@ dissect_cms_T_attrType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
 
   if(object_identifier_id) {
     name = oid_resolved_from_string(object_identifier_id);
-    proto_item_append_text(tree, " (%s)", name ? name : object_identifier_id); 
+    proto_item_append_text(tree, " (%s)", name ? name : object_identifier_id);
   }
 
 
@@ -1520,14 +1520,14 @@ dissect_cms_MessageDigest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
     offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        NULL);
 
+
   pi = actx->created_item;
 
   /* move past TLV */
   old_offset = get_ber_identifier(tvb, old_offset, NULL, NULL, NULL);
   old_offset = get_ber_length(tvb, old_offset, NULL, NULL);
 
-  if(content_tvb) 
+  if(content_tvb)
     cms_verify_msg_digest(pi, content_tvb, x509af_get_last_algorithm_id(), tvb, old_offset);
 
 
@@ -1595,8 +1595,8 @@ dissect_cms_RC2ParameterVersion(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
                                                 &length);
 
 
-  if(cap_tree != NULL) 
-    proto_item_append_text(cap_tree, " (%d bits)", length); 
+  if(cap_tree != NULL)
+    proto_item_append_text(cap_tree, " (%d bits)", length);
 
 
 
@@ -1649,7 +1649,7 @@ dissect_cms_T_capability(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
 
   if(object_identifier_id) {
     name = oid_resolved_from_string(object_identifier_id);
-    proto_item_append_text(tree, " %s", name ? name : object_identifier_id); 
+    proto_item_append_text(tree, " %s", name ? name : object_identifier_id);
     cap_tree = tree;
   }
 
index 0912d5696a4018eaeae731b8f8ae79a8a547306f..5ec940fcde47817546384b985366ae340fb0465a 100644 (file)
@@ -2704,11 +2704,11 @@ info_to_display(tvbuff_t *tvb, proto_item *stt, int offset, int octets, const ch
         default:
 
              if (mode==FMT_HEX) {
-                pi = proto_tree_add_bytes(stt, *hf_proto_parameter,
-                   tvb, offset, octets, tvb_get_ptr(tvb, offset,octets));
+                pi = proto_tree_add_item(stt, *hf_proto_parameter,
+                   tvb, offset, octets, ENC_NA);
              } else if (mode==FMT_IPv6 && octets==16) {
-                pi = proto_tree_add_ipv6(stt, *hf_proto_parameter, tvb, offset, octets,
-                   tvb_get_ptr(tvb, offset, octets));
+                pi = proto_tree_add_item(stt, *hf_proto_parameter, tvb, offset, octets,
+                   ENC_NA);
              } else if (mode==FMT_DEC && octets==8) {
                 code64 = tvb_get_ntoh64(tvb, offset);
                 pi = proto_tree_add_uint64_format(stt, *hf_proto_parameter, tvb, offset, octets,
index 8e23f866029c47292578e8bd54fbadc04924b68b..2c0e14de62048235ee1cd6a111876d514c7a1c9c 100644 (file)
@@ -89,12 +89,10 @@ static gint ett_dcc_trace = -1;
 
 #define D_TEXT(label, endpad) { \
        int next_offset,linelen,left; \
-       const char *line; \
        while (tvb_offset_exists(tvb, offset+endpad)) { \
                left = tvb_length_remaining(tvb,offset) - endpad; \
                linelen = tvb_find_line_end(tvb, offset, left, &next_offset, \
                    FALSE); \
-               line = tvb_get_ptr(tvb, offset, linelen); \
                proto_tree_add_text(dcc_optree, tvb, offset, \
                        next_offset - offset, "%s: %s", \
                        label, tvb_format_text(tvb, offset, next_offset - offset)); \
index d4677520fbe24772d14668f6070b3c747c67f0ab..23a49510fe94219a3a4b3d1cd17dc34d9ab28dd3 100644 (file)
@@ -6316,7 +6316,7 @@ dissect_dcm_pdv_fragmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
 
                    pdv->data = g_malloc(next_tvb->length);      /* will be freed in dcm_export_create_object() */
                    if (pdv->data) {
-                       memmove(pdv->data, tvb_get_ptr(next_tvb, 0, next_tvb->length), next_tvb->length);
+                       tvb_memcpy(next_tvb, pdv->data, 0, next_tvb->length);
                        pdv->data_len = next_tvb->length;
                    }
 
@@ -6336,7 +6336,7 @@ dissect_dcm_pdv_fragmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
 
            pdv->data = g_malloc(pdv_body_len);      /* will be freed in dcm_export_create_object() */
            if (pdv->data) {
-               memmove(pdv->data, tvb_get_ptr(tvb, startpos, pdv_body_len), pdv_body_len);
+               tvb_memcpy(tvb, pdv->data, startpos, pdv_body_len);
                pdv->data_len = pdv_body_len;
            }
 
index 6449f40dd0b7a4b89390760588b38f5028397702..4beb4dc7e8c3100cd3712a1d96ef146e222d35dd 100644 (file)
@@ -405,7 +405,6 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset)
        if (adr_ofs) {
                proto_tree *adr_tree;
                unsigned char *tmp;
-               const guint8 *ip;
                guint16 net;
                guint8  node;
                guint16 port;
@@ -422,13 +421,11 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset)
                        type =  tvb_get_guint8(tvb, ofs +1);
                        switch (type) {
                        case 1: /* IP */
-                               ip = tvb_get_ptr(tvb, ofs+2, 4);
-                               ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip: %s", ip_to_str(ip));
+                               ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip: %s", tvb_ip_to_str(tvb, ofs+2));
                                break;
                        case 2: /* IP + port */
-                               ip = tvb_get_ptr(tvb, ofs+2, 4);
                                port = tvb_get_ntohs(tvb, ofs+6);
-                               ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip %s:%d",ip_to_str(ip),port);
+                               ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip %s:%d", tvb_ip_to_str(tvb, ofs+2), port);
                                break;
                        case 3: /* DDP, atalk_addr_to_str want host order not network */
                                net  = tvb_get_ntohs(tvb, ofs+2);
@@ -450,15 +447,13 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset)
                                }
                                break;
                        case 6: /* IP6 */
-                               ip = tvb_get_ptr(tvb, ofs+2, INET6_ADDRLEN);
                                ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip6: %s",
-                                               ip6_to_str((const struct e_in6_addr *)ip));
+                                               tvb_ip6_to_str(tvb, ofs+2));
                                break;
                        case 7: /* IP6 + 2bytes port */
-                               ip = tvb_get_ptr(tvb, ofs+2, INET6_ADDRLEN);
                                port = tvb_get_ntohs(tvb, ofs+ 2+INET6_ADDRLEN);
                                ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip6 %s:%d",
-                                               ip6_to_str((const struct e_in6_addr *)ip),port);
+                                               tvb_ip6_to_str(tvb, ofs+2), port);
                                break;
                        default:
                                ti = proto_tree_add_text(adr_tree, tvb, ofs, len,"Unknown type : %d", type);
index 70fab56e005fd948af4167a39abddb334d428ab0..bcd99bac4078e627c7eb4364c314ec4ead79e7d0 100644 (file)
@@ -684,9 +684,8 @@ dissect_dtpt_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        if (dtpt_blob_tree) {
                                proto_tree_add_uint(dtpt_blob_tree, hf_dtpt_blob_data_length,
                                        tvb, offset+0, 4, blob_data_length);
-                               proto_tree_add_bytes(dtpt_blob_tree, hf_dtpt_blob_data,
-                                       tvb, offset+4, blob_data_length,
-                                       tvb_get_ptr(tvb, offset+4, blob_data_length));
+                               proto_tree_add_item(dtpt_blob_tree, hf_dtpt_blob_data,
+                                       tvb, offset+4, blob_data_length, ENC_NA);
                        }
                }
                offset += 4+blob_data_length;
index c71d015bd64a67678aa3ccd7bac72d5fecbd1d21..f566ff1dd59278357bc7b0f9e0cd5633ed0f075e 100644 (file)
@@ -46,12 +46,11 @@ static gint ett_echo = -1;
 
 static void dissect_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-  
+
   proto_tree   *echo_tree = NULL;
   proto_item   *ti, *hidden_item;
   int           offset = 0;
   gboolean      request = FALSE;
-  const guint8 *data = tvb_get_ptr(tvb, offset, -1);
 
   if (pinfo->destport == ECHO_PORT) {
     request = TRUE;
@@ -60,10 +59,10 @@ static void dissect_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   col_set_str(pinfo->cinfo, COL_PROTOCOL, "ECHO");
 
   if (check_col(pinfo->cinfo, COL_INFO)) {
-    col_set_str(pinfo->cinfo, COL_INFO, 
+    col_set_str(pinfo->cinfo, COL_INFO,
                 (request) ? "Request" : "Response");
   }
-  
+
   if (tree) {
 
     ti = proto_tree_add_item(tree, proto_echo, tvb, offset, -1, FALSE);
@@ -76,26 +75,26 @@ static void dissect_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     }
     PROTO_ITEM_SET_HIDDEN(hidden_item);
 
-    proto_tree_add_bytes(echo_tree, hf_echo_data, tvb, offset, -1, data);
+    proto_tree_add_item(echo_tree, hf_echo_data, tvb, offset, -1, ENC_NA);
 
   }
 
 } /* dissect_echo */
 
-void proto_register_echo(void) 
+void proto_register_echo(void)
 {
 
   static hf_register_info hf[] = {
     { &hf_echo_data,
-      { "Echo data",   "echo.data", 
+      { "Echo data",   "echo.data",
        FT_BYTES,       BASE_NONE,      NULL,   0x0,
        NULL, HFILL }},
     { &hf_echo_request,
-      { "Echo request",        "echo.request", 
+      { "Echo request",        "echo.request",
        FT_BOOLEAN,     BASE_NONE,      NULL,   0x0,
        "Echo data", HFILL }},
     { &hf_echo_response,
-      { "Echo response","echo.response", 
+      { "Echo response","echo.response",
        FT_BOOLEAN,     BASE_NONE,      NULL,   0x0,
        "Echo data", HFILL }}
   };
@@ -110,7 +109,7 @@ void proto_register_echo(void)
 
 }
 
-void proto_reg_handoff_echo(void) 
+void proto_reg_handoff_echo(void)
 {
 
   dissector_handle_t echo_handle;
index 4ad884f367e3cdb0d26bfd5d525372b6b85c8691..24358773596d2a7101ad9ce68f38489cc973ce96 100644 (file)
@@ -36,7 +36,7 @@
 #include <epan/prefs.h>
 
 #define FCIP_ENCAP_HEADER_LEN                    28
-#define FCIP_MIN_HEADER_LEN                      16 /* upto frame len field */ 
+#define FCIP_MIN_HEADER_LEN                      16 /* upto frame len field */
 #define FCIP_IS_SF(pflags)                       ((pflags & 0x1) == 0x1)
 #define FCIP_IS_CH(pflags)                       ((pflags & 0x80) == 0x80)
 
@@ -165,7 +165,7 @@ get_next_fcip_header_offset (tvbuff_t *tvb, packet_info *pinfo, gint offset)
      *
      * As per the FCIP standard, in addition, at least 3 of the following set
      * of tests must be performed to identify that we've located the start of
-     * an FCIP frame. 
+     * an FCIP frame.
      * a)  Protocol# ones complement field (1 test);
      * b)  Version ones complement field (1 test);
      * c)  Replication of encapsulation word 0 in word 1 (1 test);
@@ -216,7 +216,7 @@ NXT_BYTE: while (bytes_remaining) {
 
         flen = (tvb_get_ntohs (tvb, offset+12)) & 0x03FF;
         frame_len = (tvb_get_ntohs (tvb, offset+12) & 0x03FF)*4;
-        
+
         if ((flen < 15) || (flen > 545)) {
             /* Frame length check failed. Skip byte and try again */
             offset++;
@@ -225,7 +225,7 @@ NXT_BYTE: while (bytes_remaining) {
         }
 
         flen1 = (tvb_get_ntohs (tvb, offset+14)) & 0x03FF;
-        
+
         if ((flen & 0x03FF) != ((~flen1)&0x03FF)) {
             /* frame_len and its one's complement are not the same */
             offset++;
@@ -246,7 +246,7 @@ NXT_BYTE: while (bytes_remaining) {
                 bytes_remaining--;
                 goto NXT_BYTE;
             }
-            
+
             if ((eof != ~eofc) ||
                 (eof != tvb_get_guint8 (tvb, offset+(frame_len-1)*4+1)) ||
                 (eofc != tvb_get_guint8 (tvb, offset+(frame_len-1)*4+3))) {
@@ -255,7 +255,7 @@ NXT_BYTE: while (bytes_remaining) {
                 goto NXT_BYTE;
             }
         }
-        
+
         /* Test d */
         if ((tvb_get_guint8 (tvb, offset+9) != 0) ||
             (tvb_get_guint8 (tvb, offset+11) != 0xFF)) {
@@ -264,7 +264,7 @@ NXT_BYTE: while (bytes_remaining) {
             bytes_remaining--;
             goto NXT_BYTE;
         }
-        
+
         /* Test e */
 
 
@@ -272,10 +272,10 @@ NXT_BYTE: while (bytes_remaining) {
         * We dont test this since some implementations actually provide
         * a CRC here.
         */
-        
+
         if (bytes_remaining >= (frame_len)) {
             if (tvb_bytes_exist (tvb, offset+frame_len, 8)) {
-                /* The start of the next header matches what we wish to see */ 
+                /* The start of the next header matches what we wish to see */
                 if (tvb_memeql (tvb, offset+frame_len, fcip_header_8_bytes,
                                 8) == 0) {
                     return (offset);
@@ -317,7 +317,7 @@ static void
 dissect_fcencap_header (tvbuff_t *tvb, proto_tree *tree, gint offset)
 {
     guint8 protocol = tvb_get_guint8 (tvb, offset);
-    
+
     if (tree) {
         proto_tree_add_uint (tree, hf_fcip_protocol, tvb, offset, 1, protocol);
         proto_tree_add_item (tree, hf_fcip_version, tvb, offset+1, 1, 0);
@@ -352,10 +352,10 @@ dissect_fcip_sf (tvbuff_t *tvb, proto_tree *tree, gint offset)
     if (tree) {
         proto_tree_add_string (tree, hf_fcip_src_wwn, tvb, offset, 8,
                                fcwwn_to_str (tvb_get_ptr (tvb, offset, 8)));
-        proto_tree_add_bytes (tree, hf_fcip_src_entity_id, tvb, offset+8, 8,
-                              tvb_get_ptr (tvb, offset+8, 8));
-        proto_tree_add_bytes (tree, hf_fcip_conn_nonce, tvb, offset+16, 8,
-                              tvb_get_ptr (tvb, offset+16, 8));
+        proto_tree_add_item (tree, hf_fcip_src_entity_id, tvb, offset+8, 8,
+                              ENC_NA);
+        proto_tree_add_item (tree, hf_fcip_conn_nonce, tvb, offset+16, 8,
+                              ENC_NA);
         /* XXX - break out these flags */
         proto_tree_add_item (tree, hf_fcip_conn_flags, tvb, offset+24, 1, 0);
         proto_tree_add_item (tree, hf_fcip_conn_code, tvb, offset+26, 2, 0);
@@ -378,7 +378,7 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     proto_item *ti;
     proto_tree *fcip_tree = NULL;
     tvbuff_t *next_tvb;
-    
+
     if (bytes_remaining < FCIP_ENCAP_HEADER_LEN) {
         return FALSE;
     }
@@ -389,7 +389,7 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     }
 
     while (bytes_remaining > FCIP_ENCAP_HEADER_LEN) {
-        if ((offset = get_next_fcip_header_offset (tvb, pinfo, offset)) == -1) { 
+        if ((offset = get_next_fcip_header_offset (tvb, pinfo, offset)) == -1) {
             return FALSE;
         }
         else if (offset == -2) {
@@ -417,9 +417,9 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                 return (TRUE);
             }
         }
-        
+
         pflags = tvb_get_guint8 (tvb, start+8);
-        
+
         if (tree) {
             if (FCIP_IS_SF (pflags)) {
                 ti = proto_tree_add_protocol_format (tree, proto_fcip, tvb, 0,
@@ -440,7 +440,7 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
             }
             else {
                 sof = tvb_get_guint8 (tvb, offset+FCIP_ENCAP_HEADER_LEN);
-                
+
                 ti = proto_tree_add_protocol_format (tree, proto_fcip, tvb, 0,
                                                      FCIP_ENCAP_HEADER_LEN,
                                                      "FCIP (%s/%s)",
@@ -459,7 +459,7 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                 proto_tree_add_item (fcip_tree, hf_fcip_sof, tvb, offset, 1, 0);
                 proto_tree_add_item (fcip_tree, hf_fcip_sof_c, tvb, offset+2, 1, 0);
                 /* print EOF */
-                
+
                 offset += (frame_len-FCIP_ENCAP_HEADER_LEN-4);
                 if (tvb_bytes_exist (tvb, offset, 4)) {
                     proto_tree_add_item (fcip_tree, hf_fcip_eof, tvb, offset, 1, 0);
@@ -488,7 +488,7 @@ dissect_fcip (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                     pinfo->sof_eof |= PINFO_EOF_INVALID;
                 }
             }
-            
+
             /* Special frame bit is not set */
             next_tvb = tvb_new_subset_remaining (tvb, FCIP_ENCAP_HEADER_LEN+4);
             if (fc_handle) {
@@ -543,7 +543,7 @@ proto_register_fcip (void)
           {"Protocol (1's Complement)", "fcip.protoc", FT_UINT8, BASE_DEC,
            NULL, 0, NULL, HFILL}},
         { &hf_fcip_version,
-          {"Version", "fcip.version", FT_UINT8, BASE_DEC, 
+          {"Version", "fcip.version", FT_UINT8, BASE_DEC,
            NULL, 0, NULL, HFILL}},
         { &hf_fcip_version_c,
           {"Version (1's Complement)", "fcip.versionc", FT_UINT8, BASE_DEC,
@@ -552,7 +552,7 @@ proto_register_fcip (void)
           {"FCIP Encapsulation Word1", "fcip.encap_word1", FT_UINT32, BASE_HEX,
            NULL, 0, NULL, HFILL}},
         { &hf_fcip_flags,
-          {"Flags", "fcip.flags", FT_UINT8, BASE_HEX, 
+          {"Flags", "fcip.flags", FT_UINT8, BASE_HEX,
            NULL, 0xFC, NULL, HFILL}},
         { &hf_fcip_flags_c,
           {"Flags (1's Complement)", "fcip.flagsc", FT_UINT8, BASE_HEX,
@@ -564,25 +564,25 @@ proto_register_fcip (void)
           {"Frame Length (1's Complement)", "fcip.framelenc", FT_UINT16, BASE_DEC,
            NULL, 0x03FF, NULL, HFILL}},
         { &hf_fcip_tsec,
-          {"Time (secs)", "fcip.tsec", FT_UINT32, BASE_DEC, 
+          {"Time (secs)", "fcip.tsec", FT_UINT32, BASE_DEC,
            NULL, 0, NULL, HFILL}},
         { &hf_fcip_tusec,
-          {"Time (fraction)", "fcip.tusec", FT_UINT32, BASE_DEC, 
+          {"Time (fraction)", "fcip.tusec", FT_UINT32, BASE_DEC,
            NULL, 0, NULL, HFILL}},
         { &hf_fcip_encap_crc,
           {"CRC", "fcip.encap_crc", FT_UINT32, BASE_HEX,
            NULL, 0, NULL, HFILL}},
         { &hf_fcip_sof,
-          {"SOF", "fcip.sof", FT_UINT8, BASE_HEX, 
+          {"SOF", "fcip.sof", FT_UINT8, BASE_HEX,
            VALS (&fcip_sof_vals), 0, NULL, HFILL}},
         { &hf_fcip_sof_c,
-          {"SOF (1's Complement)", "fcip.sofc", FT_UINT8, BASE_HEX, 
+          {"SOF (1's Complement)", "fcip.sofc", FT_UINT8, BASE_HEX,
            NULL, 0, NULL, HFILL}},
         { &hf_fcip_eof,
-          {"EOF", "fcip.eof", FT_UINT8, BASE_HEX, 
+          {"EOF", "fcip.eof", FT_UINT8, BASE_HEX,
            VALS (&fcip_eof_vals), 0, NULL, HFILL}},
         { &hf_fcip_eof_c,
-          {"EOF (1's Complement)", "fcip.eofc", FT_UINT8, BASE_HEX, 
+          {"EOF (1's Complement)", "fcip.eofc", FT_UINT8, BASE_HEX,
            NULL, 0, NULL, HFILL}},
         { &hf_fcip_pflags_changed,
           {"Changed Flag", "fcip.pflags.ch", FT_BOOLEAN, 8,
@@ -619,7 +619,7 @@ proto_register_fcip (void)
     static gint *ett[] = {
         &ett_fcip,
     };
-    
+
     module_t *fcip_module;
 
     /* Register the protocol name and description */
index fe1974226c72c8edaf8c77e3449178ab71392e08..d7c34325e26d9383025b708d294eb195872f51de 100644 (file)
@@ -3049,16 +3049,13 @@ de_sm_apn(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add
 {
        guint32 curr_offset;
        guint   curr_len;
-       const guint8    *cptr;
        guint8    str[MAX_APN_LENGTH+1];
 
-       cptr = tvb_get_ptr(tvb, offset, len);
-
        curr_offset = offset;
 
        /* init buffer and copy it */
        memset ( str , 0 , MAX_APN_LENGTH );
-       memcpy ( str , cptr , len<MAX_APN_LENGTH?len:MAX_APN_LENGTH );
+       tvb_memcpy(tvb, str, offset, len<MAX_APN_LENGTH?len:MAX_APN_LENGTH);
 
        curr_len = 0;
        while (( curr_len < len ) && ( curr_len < MAX_APN_LENGTH ))
@@ -5593,7 +5590,7 @@ dtap_sm_mod_pdp_acc_net(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint l
 
 /*
  * [8] 9.5.13 Modify PDP Context Reject
- * Direction:                  both 
+ * Direction:                  both
  */
 static void
 dtap_sm_mod_pdp_rej(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len)
index d90cd9cb1d04a932167adf45b37035b8f47eb685..bacfa7f4bf5067d0bc49018d5c89af54a7751366 100644 (file)
@@ -2846,7 +2846,7 @@ dissect_gsm_map_T_extType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
   }else{
         call_dissector(data_handle, tvb, actx->pinfo, tree);
         offset = tvb_length_remaining(tvb,offset);
-  }    
+  }
 
 
 
@@ -3094,11 +3094,11 @@ MAP interfaces
  guint8                length;
  tvbuff_t      *next_tvb;
  proto_tree *subtree;
+
  ProtocolId = 0xffffffff;
   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    gsm_map_ExternalSignalInfo_sequence, hf_index, ett_gsm_map_ExternalSignalInfo);
+
 if (!actx->value_ptr)
        return offset;
  subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_externalsignalinfo);
@@ -3118,7 +3118,7 @@ if (!actx->value_ptr)
                 /* Branch on tag */
                 switch(octet){
                 case 4:
-                       /* Dissect the data part */                     
+                       /* Dissect the data part */
                        de_bearer_cap(actx->value_ptr, subtree, 2, length, NULL, 0);
                        /* TODO: There may be more than one IE */
                        break;
@@ -3141,8 +3141,8 @@ if (!actx->value_ptr)
                        proto_tree_add_item(subtree, hf_gsm_map_dlci, actx->value_ptr, 1,1,FALSE);
                        proto_tree_add_item(subtree, hf_gsm_map_len, actx->value_ptr, 2,1,FALSE);
                        next_tvb = tvb_new_subset_remaining(actx->value_ptr, 3);
-                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree); 
-               }       
+                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
+               }
                break;
        case 3:
        /* gsm-BSSMAP TODO Is it correct to stripp off two first octets here?*/
@@ -3236,7 +3236,7 @@ dissect_gsm_map_LongSignalInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
  if (!parameter_tvb)
        return offset;
 
- subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LongSignalInfo); 
+ subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LongSignalInfo);
 
  switch (AccessNetworkProtocolId){
        /* ts3G-48006 */
@@ -3255,12 +3255,12 @@ dissect_gsm_map_LongSignalInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
                        proto_tree_add_item(subtree, hf_gsm_map_len, parameter_tvb, 2,1,FALSE);
                        length = tvb_get_guint8(parameter_tvb,0);
                        next_tvb = tvb_new_subset_remaining(parameter_tvb, 3);
-                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree); 
-               }       
+                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
+               }
                break;
        /* ts3G-25413 */
        case 2:
-               call_dissector(ranap_handle, parameter_tvb, actx->pinfo, tree); 
+               call_dissector(ranap_handle, parameter_tvb, actx->pinfo, tree);
                break;
        default:
                break;
@@ -3443,17 +3443,17 @@ dissect_gsm_map_HLR_List(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
 int
 dissect_gsm_map_GlobalCellId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 781 "gsm_map.cnf"
-    tvbuff_t   *parameter_tvb; 
+    tvbuff_t   *parameter_tvb;
        proto_tree      *subtree;
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
-                return offset; 
 
-    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GlobalCellId); 
+       if (!parameter_tvb)
+                return offset;
+
+    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GlobalCellId);
        be_cell_id_aux(parameter_tvb, subtree, 0, tvb_length_remaining(tvb,0), NULL, 0, 0);
 
 
@@ -3711,17 +3711,17 @@ int
 dissect_gsm_map_LAIFixedLength(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 560 "gsm_map.cnf"
 
-        tvbuff_t        *parameter_tvb; 
-        proto_tree *subtree; 
+        tvbuff_t        *parameter_tvb;
+        proto_tree *subtree;
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-         if (!parameter_tvb) 
-                return offset; 
-        subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LAIFixedLength); 
-        dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, TRUE); 
+
+         if (!parameter_tvb)
+                return offset;
+        subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LAIFixedLength);
+        dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, TRUE);
 
 
 
@@ -3851,12 +3851,12 @@ dissect_gsm_map_Ext_SS_Status(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
  octet = tvb_get_guint8(parameter_tvb,0);
 
  proto_tree_add_uint(tree, hf_gsm_map_Ss_Status_unused, parameter_tvb, 0,1,octet);
- if ((octet & 0x01)== 1)       
+ if ((octet & 0x01)== 1)
        proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_q_bit, parameter_tvb, 0,1,octet);
-                                                                               
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);                                                                   
+
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);
 
 
 
@@ -3973,12 +3973,12 @@ dissect_gsm_map_ss_SS_Status(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
  octet = tvb_get_guint8(parameter_tvb,0);
 
  proto_tree_add_uint(tree, hf_gsm_map_Ss_Status_unused, parameter_tvb, 0,1,octet);
- if ((octet & 0x01)== 1)       
+ if ((octet & 0x01)== 1)
        proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_q_bit, parameter_tvb, 0,1,octet);
-                                                                               
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);                                                                   
- proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);                                                                   
+
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);
+ proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);
 
 
 
@@ -4342,12 +4342,12 @@ dissect_gsm_map_ss_USSD_String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
   tvbuff_t     *parameter_tvb;
   int                  length;
   guint8               out_len;
-  /* XXX - The maximum item label length is 240.  Does this really need to be 1024? 
+  /* XXX - The maximum item label length is 240.  Does this really need to be 1024?
    * use ep_alloc ?
    */
   static unsigned char msgbuf[1024];
   gchar *utf8_text = NULL;
-  GIConv cd;   
+  GIConv cd;
   GError *l_conv_error = NULL;
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
@@ -4369,7 +4369,7 @@ dissect_gsm_map_ss_USSD_String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
        proto_tree_add_text(tree, parameter_tvb, 0, length, "USSD String: %s", utf8_text);
        break;
     case SMS_ENCODING_8BIT:
-       proto_tree_add_text(tree, parameter_tvb , 0, length, "USSD String: %s", tvb_get_ptr(parameter_tvb, 0, length));
+       proto_tree_add_text(tree, parameter_tvb , 0, length, "USSD String: %s", tvb_get_ephemeral_string(parameter_tvb, 0, length));
        break;
     case SMS_ENCODING_UCS2:
     case SMS_ENCODING_UCS2_LANG:
@@ -4382,14 +4382,14 @@ dissect_gsm_map_ss_USSD_String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
                proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_convert_with_iconv FAILED");
 
            g_free(utf8_text);
-           g_iconv_close(cd);                          
+           g_iconv_close(cd);
        }
        else
            proto_tree_add_text(tree, tvb, 0, length, "USSD String: g_iconv_open FAILED contact wireshark");
 
        break;
     default:
-       break;  
+       break;
   }
 
 
@@ -7702,9 +7702,9 @@ dissect_gsm_map_ms_IntegrityProtectionInformation(gboolean implicit_tag _U_, tvb
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
+
+       if (!parameter_tvb)
                 return offset;
 
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
@@ -7725,9 +7725,9 @@ dissect_gsm_map_ms_EncryptionInformation(gboolean implicit_tag _U_, tvbuff_t *tv
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
+
+       if (!parameter_tvb)
                 return offset;
 
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
@@ -7805,17 +7805,17 @@ dissect_gsm_map_ms_AllowedUMTS_Algorithms(gboolean implicit_tag _U_, tvbuff_t *t
 static int
 dissect_gsm_map_ms_RadioResourceInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 572 "gsm_map.cnf"
-    tvbuff_t        *parameter_tvb; 
+    tvbuff_t        *parameter_tvb;
        proto_tree *subtree;
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
-                return offset; 
 
-    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_RadioResourceInformation); 
+       if (!parameter_tvb)
+                return offset;
+
+    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_RadioResourceInformation);
        be_chan_type(parameter_tvb, subtree, 0, tvb_length_remaining(tvb,0), NULL, 0);
 
 
@@ -7881,9 +7881,9 @@ dissect_gsm_map_ms_RANAP_ServiceHandover(gboolean implicit_tag _U_, tvbuff_t *tv
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
+
+       if (!parameter_tvb)
                 return offset;
 
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
@@ -13913,18 +13913,18 @@ dissect_gsm_map_lcs_ProvideSubscriberLocation_Arg(gboolean implicit_tag _U_, tvb
 int
 dissect_gsm_map_lcs_Ext_GeographicalInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
 #line 793 "gsm_map.cnf"
-    tvbuff_t   *parameter_tvb; 
+    tvbuff_t   *parameter_tvb;
        proto_tree      *subtree;
 
   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
                                        &parameter_tvb);
 
-       if (!parameter_tvb) 
-                return offset; 
+
+       if (!parameter_tvb)
+                return offset;
 
     subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GeographicalInformation);
-       dissect_geographical_description(parameter_tvb, actx->pinfo, subtree); 
+       dissect_geographical_description(parameter_tvb, actx->pinfo, subtree);
 
 
 
@@ -14874,7 +14874,7 @@ dissect_gsm_old_GSMMAPOperationLocalvalue(gboolean implicit_tag _U_, tvbuff_t *t
 
   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
                                                 &opcode);
+
   col_append_str(actx->pinfo->cinfo, COL_INFO, gsm_map_opr_code(opcode));
   col_append_fstr(actx->pinfo->cinfo, COL_INFO, " ");
 
@@ -15327,7 +15327,7 @@ For the coding of the messages see GSM 08.06 and GSM 08.08.
  ProtocolId = 0xffffffff;
   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
                                    gsm_old_Bss_APDU_sequence, hf_index, ett_gsm_old_Bss_APDU);
+
 if (!actx->value_ptr)
        return offset;
  subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_externalsignalinfo);
@@ -15347,7 +15347,7 @@ if (!actx->value_ptr)
                 /* Branch on tag */
                 switch(octet){
                 case 4:
-                       /* Dissect the data part */                     
+                       /* Dissect the data part */
                        de_bearer_cap(actx->value_ptr, subtree, 2, length, NULL, 0);
                        /* TODO: There may be more than one IE */
                        break;
@@ -15370,8 +15370,8 @@ if (!actx->value_ptr)
                        proto_tree_add_item(subtree, hf_gsm_map_dlci, actx->value_ptr, 1,1,FALSE);
                        proto_tree_add_item(subtree, hf_gsm_map_len, actx->value_ptr, 2,1,FALSE);
                        next_tvb = tvb_new_subset_remaining(actx->value_ptr, 3);
-                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree); 
-               }       
+                       call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
+               }
                break;
        case 3:
        /* gsm-BSSMAP -- Value 3 is reserved and must not be used*/
index 2e207ca82f39cde1e59625d6021df8622909096c..5e0e3269b0132d5a71689a84bf2c81355e37a323 100644 (file)
@@ -51,7 +51,7 @@ static gint ett_ipsictl_pdu = -1;
 
 static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-  
+
   proto_tree   *ipsictl_tree = NULL;
   proto_tree   *pdu_tree = NULL;
   proto_item   *ti;
@@ -68,7 +68,6 @@ static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   guint16       field1=0;
   guint16       pdu=0;
   int          haspdus=0;
-  const guint8 *data;
 
   remaining_length=tvb_reported_length_remaining(tvb, offset);
 
@@ -118,7 +117,6 @@ static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
       remaining_length-=2;
       llength-=2;
     }
-    data = tvb_get_ptr(tvb, loffset, remaining_length);
 
     if (tree) {
 
@@ -165,7 +163,7 @@ static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     if (remaining_length>=2)
     {
       if (tree) {
-        proto_tree_add_bytes(pdu_tree, hf_ipsictl_data, tvb, loffset, llength, data);
+        proto_tree_add_item(pdu_tree, hf_ipsictl_data, tvb, loffset, llength, ENC_NA);
       }
       loffset+=llength; remaining_length-=llength;
     }
@@ -176,10 +174,8 @@ static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
   if (!haspdus)
   {
-    data = tvb_get_ptr(tvb, offset, remaining_length);
-
     if (tree) {
-      proto_tree_add_bytes(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, data);
+      proto_tree_add_item(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, ENC_NA);
     }
   }
 
@@ -204,36 +200,36 @@ static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
 } /* dissect_ipsictl */
 
-void proto_register_ipsictl(void) 
+void proto_register_ipsictl(void)
 {
 
   static hf_register_info hf[] = {
     { &hf_ipsictl_pdu,
-      { "PDU", "ipsictl.pdu", 
+      { "PDU", "ipsictl.pdu",
        FT_UINT16,      BASE_HEX,       NULL,   0x0,
        "IPSICTL PDU", HFILL }},
     { &hf_ipsictl_magic,
-      { "Magic",       "ipsictl.magic", 
+      { "Magic",       "ipsictl.magic",
        FT_UINT16,      BASE_HEX,       NULL,   0x0,
        "IPSICTL Magic", HFILL }},
     { &hf_ipsictl_length,
-      { "Length",      "ipsictl.length", 
+      { "Length",      "ipsictl.length",
        FT_UINT16,      BASE_HEX,       NULL,   0x0,
        "IPSICTL Length", HFILL }},
     { &hf_ipsictl_type,
-      { "Type",        "ipsictl.type", 
+      { "Type",        "ipsictl.type",
        FT_UINT16,      BASE_HEX,       NULL,   0x0,
        "IPSICTL Type", HFILL }},
     { &hf_ipsictl_sequence,
-      { "Sequence",    "ipsictl.sequence", 
+      { "Sequence",    "ipsictl.sequence",
        FT_UINT16,      BASE_HEX,       NULL,   0x0,
        "IPSICTL Sequence", HFILL }},
     { &hf_ipsictl_field1,
-      { "Field1",      "ipsictl.field1", 
+      { "Field1",      "ipsictl.field1",
        FT_UINT16,      BASE_HEX,       NULL,   0x0,
        "IPSICTL Field1", HFILL }},
     { &hf_ipsictl_data,
-      { "Data",        "ipsictl.data", 
+      { "Data",        "ipsictl.data",
        FT_BYTES,       BASE_NONE,      NULL,   0x0,
        "IPSICTL data", HFILL }},
   };
@@ -249,7 +245,7 @@ void proto_register_ipsictl(void)
 
 }
 
-void proto_reg_handoff_ipsictl(void) 
+void proto_reg_handoff_ipsictl(void)
 {
 
   dissector_handle_t ipsictl_handle = NULL;
index 076d6d382f80e094a51eaaed3ccc732065e25399..a31ee4cb6270daae09e3c791c84e20dd39eded26 100644 (file)
@@ -608,7 +608,7 @@ addTextKeys(packet_info *pinfo, proto_tree *tt, tvbuff_t *tvb, gint offset, guin
            len = len + 1;
        }
 
-       key = ep_strndup(tvb_get_ptr(tvb, offset, len), len);
+       key = tvb_get_ephemeral_string(tvb, offset, len);
        if (key == NULL) {
                break;
        }
index 1fb2e36204491f91812b96ec5f8b5ffb53a9105c..8b761fc7c0c1a58056c4708cea5a18bf416aeadf 100644 (file)
@@ -1527,15 +1527,12 @@ dissect_tlv_mac(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem)
 {
     proto_tree   *ti, *val_tree;
     guint8        ix;
-    const guint8 *mac;
 
     ti = proto_tree_add_text(tree, tvb, offset, rem, "MAC addresses");
     val_tree=proto_item_add_subtree(ti, ett_ldp_tlv_val);
 
     for(ix=1; rem >= 6; ix++, offset += 6, rem -= 6) {
-        mac = tvb_get_ptr(tvb, offset, 6);
-        proto_tree_add_ether(val_tree,
-                             hf_ldp_tlv_mac, tvb, offset, 6, mac);
+        proto_tree_add_item(val_tree, hf_ldp_tlv_mac, tvb, offset, 6, FALSE);
     }
     if (rem)
         proto_tree_add_text(val_tree, tvb, offset, rem,