Remove a few wrong use of tvb_get_string()

Change-Id: I7095e12439fd8c0c5cd3ce14d19662efa3fd841f
Reviewed-on: https://code.wireshark.org/review/339
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2014-02-24 23:08:50 +01:00
parent 53deb521e7
commit 92a369eaf4
4 changed files with 7 additions and 7 deletions

View File

@ -278,7 +278,7 @@ tvbuff_t * dissect_cbs_data(guint8 sms_encoding, tvbuff_t *tvb, proto_tree *tree
case SMS_ENCODING_UCS2:
case SMS_ENCODING_UCS2_LANG:
input_string = tvb_get_string(wmem_packet_scope(), tvb, offset, length);
input_string = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, offset, length);
if ((cd = g_iconv_open("UTF-8","UCS-2BE")) != (GIConv) -1)
{
utf8_text = g_convert_with_iconv(input_string, length, cd, NULL, NULL, &l_conv_error);

View File

@ -4602,7 +4602,7 @@ static const gchar *
dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo _U_)
{
decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
return tvb_get_string(wmem_packet_scope(), tvb, 0, tvb_length(tvb));
return (gchar *)tvb_memdup(wmem_packet_scope(), tvb, 0, tvb_length(tvb));
}
#define MAX_APN_LENGTH 100

View File

@ -2396,7 +2396,7 @@ dissect_control_0e(tvbuff_t *tvb, proto_tree *tree)
if (len <= 0)
return;
buf = tvb_get_string(wmem_packet_scope(), tvb, 3, len);
buf = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, 3, len);
EBCDIC_to_ASCII(buf, len);
proto_tree_add_string(tree, hf_sna_control_0e_value, tvb, 3, len, (char *)buf);
}

View File

@ -595,7 +595,7 @@ static gboolean verify_control_frame_crc(tvbuff_t * tvb, packet_info * pinfo, pr
guint8 crc = 0;
guint8 * data = NULL;
/* Get data. */
data = tvb_get_string(wmem_packet_scope(), tvb, 0, tvb_length(tvb));
data = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, 0, tvb_length(tvb));
/* Include only FT flag bit in CRC calculation. */
data[0] = data[0] & 1;
/* Calculate crc7 sum. */
@ -615,7 +615,7 @@ static gboolean verify_header_crc(tvbuff_t * tvb, packet_info * pinfo, proto_ite
guint8 crc = 0;
guint8 * data = NULL;
/* Get data of header with first byte removed. */
data = tvb_get_string(wmem_packet_scope(), tvb, 1, header_length-1);
data = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, 1, header_length-1);
/* Calculate crc7 sum. */
crc = crc7update(0, data, header_length-1);
crc = crc7finalize(crc); /* finalize crc */
@ -635,7 +635,7 @@ static gboolean verify_header_crc_edch(tvbuff_t * tvb, packet_info * pinfo, prot
/* First create new subset of header with first byte removed. */
tvbuff_t * headtvb = tvb_new_subset(tvb, 1, header_length-1, header_length-1);
/* Get data of header with first byte removed. */
data = tvb_get_string(wmem_packet_scope(), headtvb, 0, header_length-1);
data = (guint8 *)tvb_memdup(wmem_packet_scope(), headtvb, 0, header_length-1);
/* Remove first 4 bits of the remaining data which are Header CRC cont. */
data[0] = data[0] & 0x0f;
crc = crc11_307_noreflect_noxor(data, header_length-1);
@ -982,7 +982,7 @@ dissect_spare_extension_and_crc(tvbuff_t *tvb, packet_info *pinfo,
ENC_BIG_ENDIAN);
if (preferences_payload_checksum) {
guint16 calc_crc, read_crc;
guint8 * data = tvb_get_string(wmem_packet_scope(), tvb, header_length, offset-header_length);
guint8 * data = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, header_length, offset-header_length);
calc_crc = crc16_8005_noreflect_noxor(data, offset-header_length);
read_crc = tvb_get_bits16(tvb, offset*8, 16, FALSE);