forked from osmocom/wireshark
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:
parent
53deb521e7
commit
92a369eaf4
4 changed files with 7 additions and 7 deletions
|
@ -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:
|
||||||
case SMS_ENCODING_UCS2_LANG:
|
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)
|
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);
|
utf8_text = g_convert_with_iconv(input_string, length, cd, NULL, NULL, &l_conv_error);
|
||||||
|
|
|
@ -4602,7 +4602,7 @@ static const gchar *
|
||||||
dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo _U_)
|
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);
|
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
|
#define MAX_APN_LENGTH 100
|
||||||
|
|
|
@ -2396,7 +2396,7 @@ dissect_control_0e(tvbuff_t *tvb, proto_tree *tree)
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
return;
|
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);
|
EBCDIC_to_ASCII(buf, len);
|
||||||
proto_tree_add_string(tree, hf_sna_control_0e_value, tvb, 3, len, (char *)buf);
|
proto_tree_add_string(tree, hf_sna_control_0e_value, tvb, 3, len, (char *)buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -595,7 +595,7 @@ static gboolean verify_control_frame_crc(tvbuff_t * tvb, packet_info * pinfo, pr
|
||||||
guint8 crc = 0;
|
guint8 crc = 0;
|
||||||
guint8 * data = NULL;
|
guint8 * data = NULL;
|
||||||
/* Get data. */
|
/* 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. */
|
/* Include only FT flag bit in CRC calculation. */
|
||||||
data[0] = data[0] & 1;
|
data[0] = data[0] & 1;
|
||||||
/* Calculate crc7 sum. */
|
/* Calculate crc7 sum. */
|
||||||
|
@ -615,7 +615,7 @@ static gboolean verify_header_crc(tvbuff_t * tvb, packet_info * pinfo, proto_ite
|
||||||
guint8 crc = 0;
|
guint8 crc = 0;
|
||||||
guint8 * data = NULL;
|
guint8 * data = NULL;
|
||||||
/* Get data of header with first byte removed. */
|
/* 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. */
|
/* Calculate crc7 sum. */
|
||||||
crc = crc7update(0, data, header_length-1);
|
crc = crc7update(0, data, header_length-1);
|
||||||
crc = crc7finalize(crc); /* finalize crc */
|
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. */
|
/* First create new subset of header with first byte removed. */
|
||||||
tvbuff_t * headtvb = tvb_new_subset(tvb, 1, header_length-1, header_length-1);
|
tvbuff_t * headtvb = tvb_new_subset(tvb, 1, header_length-1, header_length-1);
|
||||||
/* Get data of header with first byte removed. */
|
/* 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. */
|
/* Remove first 4 bits of the remaining data which are Header CRC cont. */
|
||||||
data[0] = data[0] & 0x0f;
|
data[0] = data[0] & 0x0f;
|
||||||
crc = crc11_307_noreflect_noxor(data, header_length-1);
|
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);
|
ENC_BIG_ENDIAN);
|
||||||
if (preferences_payload_checksum) {
|
if (preferences_payload_checksum) {
|
||||||
guint16 calc_crc, read_crc;
|
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);
|
calc_crc = crc16_8005_noreflect_noxor(data, offset-header_length);
|
||||||
read_crc = tvb_get_bits16(tvb, offset*8, 16, FALSE);
|
read_crc = tvb_get_bits16(tvb, offset*8, 16, FALSE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue