forked from osmocom/wireshark
Use proto_tree_add_item() in preference to fetching the string and
adding it with proto_tree_add_string(). Use tvb_get_string_enc() rather than tvb_get_unicode_string() to fetch strings. We assume a UTF-16 encoding for all "Unicode" strings. Use tvb_strsize() and tvb_unicode_strsize() to get the lengths of null-terminated strings. Get rid of unused ett_nt_unicode_string variable. svn path=/trunk/; revision=54158
This commit is contained in:
parent
54c272466f
commit
068008f04f
|
@ -47,7 +47,6 @@ static int hf_lsa_String_name_len = -1;
|
|||
static int hf_lsa_String_name_size = -1;
|
||||
static int hf_nt_data_blob_len = -1;
|
||||
|
||||
static gint ett_nt_unicode_string = -1;
|
||||
static gint ett_lsa_String = -1;
|
||||
static gint ett_nt_data_blob = -1;
|
||||
static expert_field ei_dcerpc_nt_badsid = EI_INIT;
|
||||
|
@ -108,71 +107,25 @@ dissect_null_term_string(tvbuff_t *tvb, int offset,
|
|||
packet_info *pinfo _U_, proto_tree *tree,
|
||||
guint8 *drep _U_, int hf_index, int levels _U_)
|
||||
{
|
||||
guint8 data;
|
||||
int tmp_offset = offset;
|
||||
guint32 len = 0;
|
||||
char *s;
|
||||
guint len;
|
||||
|
||||
data = tvb_get_guint8 (tvb, tmp_offset);
|
||||
for ( ;tvb_length_remaining (tvb, tmp_offset) > 0 && data; tmp_offset++) {
|
||||
data = tvb_get_guint8 (tvb, tmp_offset);
|
||||
}
|
||||
len = tvb_strsize(tvb, offset);
|
||||
proto_tree_add_item(tree, hf_index, tvb, offset, len, ENC_ASCII|ENC_NA);
|
||||
|
||||
/* Let's try to the terminator on the last char ...*/
|
||||
if (data) {
|
||||
tmp_offset++;
|
||||
data = tvb_get_guint8 (tvb, tmp_offset);
|
||||
}
|
||||
|
||||
if (data) {
|
||||
proto_tree_add_string(tree, hf_nt_error, tvb, offset,
|
||||
tmp_offset - offset, "Not a null terminated string");
|
||||
return tmp_offset;
|
||||
}
|
||||
|
||||
len = tmp_offset - offset;
|
||||
/* tvb_get_string didn't want the length with the 0*/
|
||||
s = tvb_get_string(wmem_packet_scope(), tvb, offset, len);
|
||||
proto_tree_add_string(tree, hf_index, tvb, offset, len + 1, s);
|
||||
|
||||
return tmp_offset;
|
||||
return offset + len;
|
||||
}
|
||||
|
||||
int
|
||||
dissect_null_term_wstring(tvbuff_t *tvb, int offset,
|
||||
packet_info *pinfo _U_, proto_tree *tree,
|
||||
guint8 *drep, int hf_index, int levels _U_)
|
||||
guint8 *drep _U_, int hf_index, int levels _U_)
|
||||
{
|
||||
guint16 data;
|
||||
int tmp_offset = offset;
|
||||
guint32 len = 0;
|
||||
char *s;
|
||||
guint len;
|
||||
|
||||
data = dcerpc_tvb_get_ntohs(tvb, tmp_offset, drep);
|
||||
for ( ; tvb_length_remaining (tvb, tmp_offset) > 1 && data; tmp_offset +=2) {
|
||||
data = dcerpc_tvb_get_ntohs(tvb, tmp_offset, drep);
|
||||
}
|
||||
len = tvb_unicode_strsize(tvb, offset);
|
||||
proto_tree_add_item(tree, hf_index, tvb, offset, len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
|
||||
/* Let's try to find the terminator on the last char ...*/
|
||||
|
||||
if (data) {
|
||||
tmp_offset += 2;
|
||||
data = dcerpc_tvb_get_ntohs(tvb, tmp_offset, drep);
|
||||
}
|
||||
|
||||
if (data) {
|
||||
proto_tree_add_string(tree, hf_nt_error, tvb, offset,
|
||||
tmp_offset - offset, "Not a null terminated string");
|
||||
return tmp_offset;
|
||||
}
|
||||
len = tmp_offset - offset;
|
||||
|
||||
/* tvb_get_string didn't want the length with the 0*/
|
||||
s = tvb_get_unicode_string(NULL, tvb, offset, len, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_string(tree, hf_index, tvb, offset, len, s);
|
||||
g_free(s);
|
||||
|
||||
return tmp_offset;
|
||||
return offset + len;
|
||||
}
|
||||
|
||||
/* Parse some common RPC structures */
|
||||
|
@ -1275,9 +1228,9 @@ void cb_wstr_postprocess(packet_info *pinfo, proto_tree *tree _U_,
|
|||
* some way we can get that string, rather than duplicating the
|
||||
* efforts of that routine?
|
||||
*/
|
||||
s = tvb_get_unicode_string(wmem_packet_scope(),
|
||||
s = tvb_get_string_enc(wmem_packet_scope(),
|
||||
tvb, start_offset + 12, end_offset - start_offset - 12,
|
||||
ENC_LITTLE_ENDIAN);
|
||||
ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
|
||||
/* Append string to COL_INFO */
|
||||
|
||||
|
@ -1997,7 +1950,6 @@ void dcerpc_smb_init(int proto_dcerpc)
|
|||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
&ett_nt_unicode_string,
|
||||
&ett_nt_data_blob,
|
||||
&ett_nt_counted_string,
|
||||
&ett_nt_counted_byte_array,
|
||||
|
|
|
@ -498,7 +498,7 @@ dissect_spoolss_string_parm_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|||
offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
|
||||
hf_string_parm_size, &buffer_len);
|
||||
|
||||
s = tvb_get_unicode_stringz(wmem_packet_scope(), tvb, offset, &len, ENC_LITTLE_ENDIAN);
|
||||
s = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
|
||||
if (tree && buffer_len) {
|
||||
tvb_ensure_bytes_exist(tvb, offset, buffer_len);
|
||||
|
@ -694,7 +694,7 @@ dissect_printerdata_data(tvbuff_t *tvb, int offset,
|
|||
|
||||
switch(type) {
|
||||
case DCERPC_REG_SZ: {
|
||||
char *data = tvb_get_unicode_string(NULL, tvb, offset - size, size, ENC_LITTLE_ENDIAN);
|
||||
char *data = tvb_get_string_enc(NULL, tvb, offset - size, size, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
|
||||
proto_item_append_text(item, ": %s", data);
|
||||
|
||||
|
@ -1083,7 +1083,7 @@ dissect_spoolss_uint16uni(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
|
|||
return offset;
|
||||
}
|
||||
|
||||
text = tvb_get_unicode_string(NULL, tvb, offset, remaining, ENC_LITTLE_ENDIAN);
|
||||
text = tvb_get_string_enc(NULL, tvb, offset, remaining, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
len = (int)strlen(text);
|
||||
|
||||
proto_tree_add_text(tree, tvb, offset, len * 2, "%s: %s",
|
||||
|
@ -5838,8 +5838,8 @@ cb_notify_str_postprocess(packet_info *pinfo _U_,
|
|||
|
||||
len = tvb_get_letohl(tvb, start_offset);
|
||||
|
||||
s = tvb_get_unicode_string(NULL,
|
||||
tvb, start_offset + 4, (end_offset - start_offset - 4), ENC_LITTLE_ENDIAN);
|
||||
s = tvb_get_string_enc(NULL,
|
||||
tvb, start_offset + 4, (end_offset - start_offset - 4), ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
|
||||
/* Append string to upper-level proto_items */
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ dissect_dtpt_wstring(tvbuff_t *tvb, guint offset, proto_tree *tree, int hfindex)
|
|||
guint32 wstring_padding = 0;
|
||||
|
||||
wstring_length = tvb_get_letohl(tvb, offset);
|
||||
wstring_data = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset+4, wstring_length, ENC_LITTLE_ENDIAN);
|
||||
wstring_data = tvb_get_string_enc(wmem_packet_scope(), tvb, offset+4, wstring_length, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
wstring_size = wstring_length;
|
||||
if (wstring_size%4) {
|
||||
wstring_padding = (4-wstring_size%4);
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
*
|
||||
* Routines for MicroSoft MMS (Microsoft Media Server) message dissection
|
||||
*
|
||||
* See
|
||||
*
|
||||
* http://msdn.microsoft.com/en-us/library/cc234711.aspx
|
||||
*
|
||||
* for the [MS-MMSP] specification.
|
||||
*
|
||||
* Copyright 2005
|
||||
* Written by Martin Mathieson
|
||||
*
|
||||
|
@ -760,7 +766,7 @@ static void dissect_client_transport_info(tvbuff_t *tvb, packet_info *pinfo, pro
|
|||
offset += 4;
|
||||
|
||||
/* Extract and show the string in tree and info column */
|
||||
transport_info = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, length_remaining - 20, ENC_LITTLE_ENDIAN);
|
||||
transport_info = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, length_remaining - 20, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
|
||||
proto_tree_add_string_format(tree, hf_msmms_command_client_transport_info, tvb,
|
||||
offset, length_remaining-20,
|
||||
|
@ -868,7 +874,7 @@ static void dissect_server_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
|
|||
THROW(ReportedBoundsError);
|
||||
if (server_version_length > 1)
|
||||
{
|
||||
server_version = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, server_version_length*2, ENC_LITTLE_ENDIAN);
|
||||
server_version = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, server_version_length*2, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
|
||||
/* Server version string */
|
||||
proto_tree_add_item(tree, hf_msmms_command_server_version, tvb,
|
||||
|
@ -934,7 +940,7 @@ static void dissect_client_player_info(tvbuff_t *tvb, packet_info *pinfo, proto_
|
|||
offset += 4;
|
||||
|
||||
/* Extract and show the string in tree and info column */
|
||||
player_info = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, length_remaining - 12, ENC_LITTLE_ENDIAN);
|
||||
player_info = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, length_remaining - 12, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
|
||||
proto_tree_add_item(tree, hf_msmms_command_client_player_info, tvb,
|
||||
offset, length_remaining-12,
|
||||
|
@ -1011,7 +1017,7 @@ static void dissect_request_server_file(tvbuff_t *tvb, packet_info *pinfo, proto
|
|||
offset += 4;
|
||||
|
||||
/* File path on server */
|
||||
server_file = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, length_remaining - 16, ENC_LITTLE_ENDIAN);
|
||||
server_file = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, length_remaining - 16, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
|
||||
proto_tree_add_item(tree, hf_msmms_command_server_file, tvb,
|
||||
offset, length_remaining-16,
|
||||
|
|
|
@ -1308,7 +1308,7 @@ dissect_ntlmssp_target_info_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
|
|||
case NTLM_TARGET_INFO_DNS_DOMAIN_NAME:
|
||||
case NTLM_TARGET_INFO_DNS_TREE_NAME:
|
||||
case NTLM_TARGET_INFO_TARGET_NAME:
|
||||
text = tvb_get_unicode_string(wmem_packet_scope(), tvb, content_offset, content_length, ENC_LITTLE_ENDIAN);
|
||||
text = tvb_get_string_enc(wmem_packet_scope(), tvb, content_offset, content_length, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_string(target_info_tree, *hf_array_p[item_type], tvb, content_offset, content_length, text);
|
||||
proto_item_append_text(target_info_tf, ": %s", text);
|
||||
break;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
|
@ -25,9 +24,12 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/* The official Dokumentation for the Peer Name Resolution Protocol can be found at
|
||||
http://msdn.microsoft.com/en-us/library/cc239047(PROT.13).aspx
|
||||
This dissector is based on Revision 6.1.2
|
||||
/* The official Documentation for the Peer Name Resolution Protocol
|
||||
* ([MS-PNRP]) can be found at
|
||||
*
|
||||
* http://msdn.microsoft.com/en-us/library/cc239047.aspx
|
||||
*
|
||||
* This dissector is based on Revision 6.1.2
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -221,6 +223,7 @@ static const int *inquire_flags[] = {
|
|||
static gint hf_pnrp_message_classifier_unicodeCount = -1;
|
||||
static gint hf_pnrp_message_classifier_arrayLength = -1;
|
||||
static gint hf_pnrp_message_classifier_entryLength = -1;
|
||||
static gint hf_pnrp_message_classifier_string = -1;
|
||||
/* ACK Message Flags */
|
||||
static gint hf_pnrp_message_ack_flags_reserved = -1;
|
||||
static gint hf_pnrp_message_ack_flags_Nbit = -1;
|
||||
|
@ -685,7 +688,7 @@ static int dissect_pnrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
|
|||
/* Entry Length: Must be 0x0002 */
|
||||
proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_classifier_entryLength, tvb, offset + 10, 2, ENC_BIG_ENDIAN);
|
||||
/* The actual classifier String */
|
||||
proto_tree_add_text(pnrp_message_tree, tvb, offset + 12, tvb_get_ntohs(tvb,offset+6)-8, "Classifier: %s",tvb_get_unicode_string(wmem_packet_scope(), tvb, offset + 12, tvb_get_ntohs(tvb,offset+6)-8, ENC_BIG_ENDIAN));
|
||||
proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_classifier_string, tvb, offset + 12, tvb_get_ntohs(tvb,offset+6)-8, ENC_UTF_16|ENC_BIG_ENDIAN);
|
||||
}
|
||||
|
||||
/* There might be padding, so fill up to the next byte */
|
||||
|
@ -1153,6 +1156,9 @@ void proto_register_pnrp(void)
|
|||
{ &hf_pnrp_message_classifier_entryLength,
|
||||
{ "Entry Length", "pnrp.segment.classifier.entryLength", FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_pnrp_message_classifier_string,
|
||||
{ "Classifier", "pnrp.segment.classifier.string", FT_STRING, STR_UNICODE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
/* Ack Flags */
|
||||
{ &hf_pnrp_message_ack_flags_reserved,
|
||||
{ "Reserved", "pnrp.segment.ack.flags.reserved", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
|
|
|
@ -11111,10 +11111,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo,
|
|||
COUNT_BYTES_TRANS(4);
|
||||
|
||||
/* file name */
|
||||
if (si->unicode)
|
||||
fn = tvb_get_unicode_stringz(wmem_packet_scope(), tvb, offset, &fn_len, ENC_LITTLE_ENDIAN);
|
||||
else
|
||||
fn = tvb_get_stringz(wmem_packet_scope(), tvb, offset, &fn_len);
|
||||
fn = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &fn_len, (si->unicode ? ENC_UTF_16|ENC_LITTLE_ENDIAN : ENC_ASCII|ENC_NA));
|
||||
|
||||
CHECK_STRING_TRANS(fn);
|
||||
proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len,
|
||||
|
|
|
@ -446,6 +446,8 @@ static int hf_tds_fragment_count = -1;
|
|||
static int hf_tds_collate_codepage = -1;
|
||||
static int hf_tds_collate_flags = -1;
|
||||
static int hf_tds_collate_charset_id = -1;
|
||||
static int hf_tds_table_name = -1;
|
||||
static int hf_tds_text = -1;
|
||||
|
||||
static int hf_tds7_login_total_size = -1;
|
||||
static int hf_tds7_version = -1;
|
||||
|
@ -980,7 +982,7 @@ static void
|
|||
dissect_tds_query_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tds_conv_info_t *tds_info)
|
||||
{
|
||||
guint offset, len;
|
||||
gboolean is_unicode = TRUE;
|
||||
guint string_encoding = ENC_UTF_16|ENC_LITTLE_ENDIAN;
|
||||
char *msg;
|
||||
|
||||
proto_item *query_hdr;
|
||||
|
@ -995,12 +997,9 @@ dissect_tds_query_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, td
|
|||
if (TDS_PROTO_TDS4 ||
|
||||
(!TDS_PROTO_TDS7 &&
|
||||
((len < 2) || tvb_get_guint8(tvb, offset+1) != 0)))
|
||||
is_unicode = FALSE;
|
||||
string_encoding = ENC_ASCII|ENC_NA;
|
||||
|
||||
if (is_unicode)
|
||||
msg = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, len, ENC_LITTLE_ENDIAN);
|
||||
else
|
||||
msg = (gchar*)tvb_get_string(wmem_packet_scope(), tvb, offset, len);
|
||||
msg = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, len, string_encoding);
|
||||
|
||||
proto_tree_add_text(query_tree, tvb, offset, len, "Query: %s", msg);
|
||||
offset += len;
|
||||
|
@ -1176,7 +1175,7 @@ dissect_tds7_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
if( i != 2) {
|
||||
/* tds 7 is always unicode */
|
||||
len *= 2;
|
||||
val = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset2, len, ENC_LITTLE_ENDIAN);
|
||||
val = tvb_get_string_enc(wmem_packet_scope(), tvb, offset2, len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_text(login_tree, tvb, offset2, len, "%s: %s", val_to_str_const(i, login_field_names, "Unknown"), val);
|
||||
} else {
|
||||
/* This field is the password. We retrieve it from the packet
|
||||
|
@ -1489,10 +1488,11 @@ dissect_tds_env_chg(tvbuff_t *tvb, guint offset, guint token_sz,
|
|||
string_offset = offset + 2;
|
||||
if (is_unicode == TRUE) {
|
||||
new_len *= 2;
|
||||
new_val = tvb_get_unicode_string(wmem_packet_scope(), tvb, string_offset,
|
||||
new_len, ENC_LITTLE_ENDIAN);
|
||||
new_val = tvb_get_string_enc(wmem_packet_scope(), tvb, string_offset,
|
||||
new_len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
} else
|
||||
new_val = (gchar*)tvb_get_string(wmem_packet_scope(), tvb, string_offset, new_len);
|
||||
new_val = tvb_get_string_enc(wmem_packet_scope(), tvb, string_offset,
|
||||
new_len, ENC_ASCII|ENC_NA);
|
||||
proto_tree_add_text(tree, tvb, string_offset, new_len,
|
||||
"New Value: %s", new_val);
|
||||
}
|
||||
|
@ -1513,10 +1513,11 @@ dissect_tds_env_chg(tvbuff_t *tvb, guint offset, guint token_sz,
|
|||
string_offset = old_len_offset + 1;
|
||||
if (is_unicode == TRUE) {
|
||||
old_len *= 2;
|
||||
old_val = tvb_get_unicode_string(wmem_packet_scope(), tvb, string_offset,
|
||||
old_len, ENC_LITTLE_ENDIAN);
|
||||
old_val = tvb_get_string_enc(wmem_packet_scope(), tvb, string_offset,
|
||||
old_len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
} else
|
||||
old_val = (gchar*)tvb_get_string(wmem_packet_scope(), tvb, string_offset, old_len);
|
||||
old_val = tvb_get_string_enc(wmem_packet_scope(), tvb, string_offset,
|
||||
old_len, ENC_ASCII|ENC_NA);
|
||||
proto_tree_add_text(tree, tvb, string_offset, old_len,
|
||||
"Old Value: %s", old_val);
|
||||
}
|
||||
|
@ -1546,9 +1547,9 @@ dissect_tds_err_token(tvbuff_t *tvb, guint offset, guint token_sz _U_, proto_tre
|
|||
|
||||
if(is_unicode) {
|
||||
msg_len *= 2;
|
||||
msg = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, msg_len, ENC_LITTLE_ENDIAN);
|
||||
msg = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, msg_len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
} else {
|
||||
msg = (gchar*)tvb_get_string(wmem_packet_scope(), tvb, offset, msg_len);
|
||||
msg = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, msg_len, ENC_ASCII|ENC_NA);
|
||||
}
|
||||
proto_tree_add_text(tree, tvb, offset, msg_len, "Error: %s", format_text((guchar*)msg, strlen(msg)));
|
||||
offset += msg_len;
|
||||
|
@ -1560,9 +1561,9 @@ dissect_tds_err_token(tvbuff_t *tvb, guint offset, guint token_sz _U_, proto_tre
|
|||
if(srvr_len) {
|
||||
if (is_unicode) {
|
||||
srvr_len *=2;
|
||||
msg = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, srvr_len, ENC_LITTLE_ENDIAN);
|
||||
msg = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, srvr_len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
} else {
|
||||
msg = (gchar*)tvb_get_string(wmem_packet_scope(), tvb, offset, srvr_len);
|
||||
msg = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, srvr_len, ENC_ASCII|ENC_NA);
|
||||
}
|
||||
proto_tree_add_text(tree, tvb, offset, srvr_len, "Server name: %s", msg);
|
||||
offset += srvr_len;
|
||||
|
@ -1575,9 +1576,9 @@ dissect_tds_err_token(tvbuff_t *tvb, guint offset, guint token_sz _U_, proto_tre
|
|||
if(proc_len) {
|
||||
if (is_unicode) {
|
||||
proc_len *=2;
|
||||
msg = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, proc_len, ENC_LITTLE_ENDIAN);
|
||||
msg = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, proc_len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
} else {
|
||||
msg = (gchar*)tvb_get_string(wmem_packet_scope(), tvb, offset, proc_len);
|
||||
msg = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, proc_len, ENC_ASCII|ENC_NA);
|
||||
}
|
||||
proto_tree_add_text(tree, tvb, offset, proc_len, "Process name: %s", msg);
|
||||
offset += proc_len;
|
||||
|
@ -1595,7 +1596,6 @@ dissect_tds_login_ack_token(tvbuff_t *tvb, guint offset, guint token_sz, proto_t
|
|||
{
|
||||
guint8 msg_len;
|
||||
guint32 tds_version;
|
||||
char *msg;
|
||||
gboolean is_unicode = FALSE;
|
||||
|
||||
proto_tree_add_text(tree, tvb, offset, 1, "Ack: %u", tvb_get_guint8(tvb, offset));
|
||||
|
@ -1630,11 +1630,10 @@ dissect_tds_login_ack_token(tvbuff_t *tvb, guint offset, guint token_sz, proto_t
|
|||
proto_tree_add_text(tree, tvb, offset, 0, "msg_len: %d, token_sz: %d, total: %d",msg_len, token_sz, msg_len + 6U + 3U);
|
||||
if(is_unicode) {
|
||||
msg_len *= 2;
|
||||
msg = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, msg_len, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(tree, hf_tds_text, tvb, offset, msg_len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
} else {
|
||||
msg = (gchar*)tvb_get_string(wmem_packet_scope(), tvb, offset, msg_len);
|
||||
proto_tree_add_item(tree, hf_tds_text, tvb, offset, msg_len, ENC_ASCII|ENC_NA);
|
||||
}
|
||||
proto_tree_add_text(tree, tvb, offset, msg_len, "Text: %s", format_text((guchar*)msg, strlen(msg)));
|
||||
offset += msg_len;
|
||||
|
||||
proto_tree_add_text(tree, tvb, offset, 4, "Server Version");
|
||||
|
@ -1649,7 +1648,6 @@ dissect_tds7_results_token(tvbuff_t *tvb, guint offset, proto_tree *tree, tds_co
|
|||
guint16 num_columns, table_len;
|
||||
guint8 type, msg_len;
|
||||
int i;
|
||||
char *msg;
|
||||
|
||||
num_columns = tvb_get_letohs(tvb, offset);
|
||||
proto_tree_add_text(tree, tvb, offset, 2, "Columns: %u", tvb_get_letohs(tvb, offset));
|
||||
|
@ -1685,8 +1683,7 @@ dissect_tds7_results_token(tvbuff_t *tvb, guint offset, proto_tree *tree, tds_co
|
|||
offset +=2;
|
||||
if(table_len != 0) {
|
||||
table_len *= 2;
|
||||
msg = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, table_len, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_text(tree, tvb, offset, table_len, "Table name: %s", msg);
|
||||
proto_tree_add_item(tree, hf_tds_table_name, tvb, offset, table_len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
offset += table_len;
|
||||
}
|
||||
}
|
||||
|
@ -1711,8 +1708,7 @@ dissect_tds7_results_token(tvbuff_t *tvb, guint offset, proto_tree *tree, tds_co
|
|||
offset += 1;
|
||||
if(msg_len != 0) {
|
||||
msg_len *= 2;
|
||||
msg = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, msg_len, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_text(tree, tvb, offset, msg_len, "Text: %s", msg);
|
||||
proto_tree_add_item(tree, hf_tds_text, tvb, offset, msg_len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
offset += msg_len;
|
||||
}
|
||||
}
|
||||
|
@ -1878,7 +1874,6 @@ dissect_tds_type_varbyte(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto
|
|||
#define CHARBIN_NULL 0xFFFFU
|
||||
#define CHARBIN_NULL32 0xFFFFFFFFU
|
||||
guint32 length;
|
||||
char *string_value;
|
||||
proto_tree *sub_tree = NULL;
|
||||
proto_item *item = NULL, *length_item = NULL;
|
||||
|
||||
|
@ -1913,8 +1908,7 @@ dissect_tds_type_varbyte(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto
|
|||
proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_string, tvb, *offset, length, ENC_ASCII|ENC_NA);
|
||||
break;
|
||||
case TDS_DATA_TYPE_NVARCHAR: /* NVarChar */
|
||||
string_value = tvb_get_unicode_string(wmem_packet_scope(), tvb, *offset, length, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_string(sub_tree, hf_tds_type_varbyte_data_string, tvb, *offset, length, string_value);
|
||||
proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_string, tvb, *offset, length, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
break;
|
||||
case TDS_DATA_TYPE_XML: /* XML (introduced in TDS 7.2) */
|
||||
case TDS_DATA_TYPE_UDT: /* CLR-UDT (introduced in TDS 7.2) */
|
||||
|
@ -2067,8 +2061,7 @@ dissect_tds_type_varbyte(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto
|
|||
break;
|
||||
case TDS_DATA_TYPE_NVARCHAR: /* NVarChar */
|
||||
case TDS_DATA_TYPE_NCHAR: /* NChar */
|
||||
string_value = tvb_get_unicode_string(wmem_packet_scope(), tvb, *offset, length, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_string(sub_tree, hf_tds_type_varbyte_data_string, tvb, *offset, length, string_value);
|
||||
proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_string, tvb, *offset, length, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
break;
|
||||
default:
|
||||
DISSECTOR_ASSERT_NOT_REACHED();
|
||||
|
@ -2094,8 +2087,7 @@ dissect_tds_type_varbyte(tvbuff_t *tvb, guint *offset, packet_info *pinfo, proto
|
|||
else {
|
||||
switch(data_type) {
|
||||
case TDS_DATA_TYPE_NTEXT: /* NText */
|
||||
string_value = tvb_get_unicode_string(wmem_packet_scope(), tvb, *offset, length, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_string(sub_tree, hf_tds_type_varbyte_data_string, tvb, *offset, length, string_value);
|
||||
proto_tree_add_item(sub_tree, hf_tds_type_varbyte_data_string, tvb, *offset, length, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
break;
|
||||
default: /*TODO*/
|
||||
proto_tree_add_expert_format(sub_tree, pinfo, &ei_tds_type_info_type_undecoded, tvb, *offset, length, "Data type %d not supported yet", data_type);
|
||||
|
@ -2116,7 +2108,6 @@ dissect_tds_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree *sub_tree = NULL, *status_sub_tree = NULL;
|
||||
int offset = 0;
|
||||
guint len;
|
||||
char *val;
|
||||
guint8 data_type;
|
||||
|
||||
item = proto_tree_add_item(tree, hf_tds_rpc, tvb, 0, -1, ENC_NA);
|
||||
|
@ -2149,8 +2140,7 @@ dissect_tds_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
}
|
||||
else if (len != 0) {
|
||||
len *= 2;
|
||||
val = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, len, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_string(tree, hf_tds_rpc_name, tvb, offset, len, val);
|
||||
proto_tree_add_item(tree, hf_tds_rpc_name, tvb, offset, len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
offset += len;
|
||||
}
|
||||
break;
|
||||
|
@ -2179,8 +2169,7 @@ dissect_tds_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
++offset;
|
||||
if(len) {
|
||||
len *= 2;
|
||||
val = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, len, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_string(sub_tree, hf_tds_rpc_parameter_name, tvb, offset, len, val);
|
||||
proto_tree_add_item(sub_tree, hf_tds_rpc_parameter_name, tvb, offset, len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
offset += len;
|
||||
}
|
||||
item = proto_tree_add_item(sub_tree, hf_tds_rpc_parameter_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
||||
|
@ -2778,6 +2767,16 @@ proto_register_tds(void)
|
|||
FT_UINT8, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_tds_table_name,
|
||||
{ "Table name", "tds.table_name",
|
||||
FT_STRING, STR_UNICODE, NULL, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_tds_text,
|
||||
{ "Text", "tds.text",
|
||||
FT_STRING, STR_UNICODE, NULL, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_tds_fragment_overlap,
|
||||
{ "Segment overlap", "tds.fragment.overlap",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
|
|
|
@ -247,7 +247,7 @@ static const value_string tnef_Attribute_vals[] = {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id, packet_info *pinfo, proto_tree *tree, gboolean single, gboolean unicode, guint encoding)
|
||||
static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id, packet_info *pinfo, proto_tree *tree, gboolean single, guint encoding)
|
||||
{
|
||||
proto_item *item;
|
||||
guint32 length, count, i;
|
||||
|
@ -271,12 +271,7 @@ static gint dissect_counted_values(tvbuff_t *tvb, gint offset, int hf_id, packe
|
|||
proto_tree_add_item(tree, hf_tnef_value_length, tvb, offset, 4, ENC_LITTLE_ENDIAN);
|
||||
offset += 4;
|
||||
|
||||
if (unicode) {
|
||||
char *unicode_str = tvb_get_unicode_string(wmem_packet_scope(), tvb, offset, length, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_string(tree, hf_id, tvb, offset, length, unicode_str);
|
||||
} else {
|
||||
proto_tree_add_item(tree, hf_id, tvb, offset, length, encoding);
|
||||
}
|
||||
proto_tree_add_item(tree, hf_id, tvb, offset, length, encoding);
|
||||
offset += length;
|
||||
|
||||
/* XXX: may be padding ? */
|
||||
|
@ -406,9 +401,7 @@ static void dissect_mapiprops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
|
|||
proto_tree_add_item(tag_tree, hf_tnef_property_tag_name_length, tvb, offset, 4, ENC_LITTLE_ENDIAN);
|
||||
offset += 4;
|
||||
|
||||
name_string = tvb_get_unicode_string (wmem_packet_scope(), tvb, offset, tag_length, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_string_format_value(tag_tree, hf_tnef_property_tag_name_string, tvb, offset,
|
||||
tag_length, name_string, "%s", name_string);
|
||||
proto_tree_add_item(tag_tree, hf_tnef_property_tag_name_string, tvb, offset, tag_length, ENC_UTF_16|ENC_LITTLE_ENDIAN);
|
||||
offset += tag_length;
|
||||
|
||||
if((padding = (4 - tag_length % 4)) != 4) {
|
||||
|
@ -437,14 +430,13 @@ static void dissect_mapiprops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
|
|||
break;
|
||||
case PT_STRING8:
|
||||
/* XXX - code page? */
|
||||
offset = dissect_counted_values(tvb, offset, hf_tnef_PropValue_lpszA, pinfo, prop_tree, TRUE, FALSE, ENC_ASCII|ENC_NA);
|
||||
offset = dissect_counted_values(tvb, offset, hf_tnef_PropValue_lpszA, pinfo, prop_tree, TRUE, ENC_ASCII|ENC_NA);
|
||||
break;
|
||||
case PT_BINARY:
|
||||
offset = dissect_counted_values(tvb, offset, hf_tnef_PropValue_bin, pinfo, prop_tree, TRUE, FALSE, ENC_NA);
|
||||
offset = dissect_counted_values(tvb, offset, hf_tnef_PropValue_bin, pinfo, prop_tree, TRUE, ENC_NA);
|
||||
break;
|
||||
case PT_UNICODE:
|
||||
/* XXX - UCS-2 and UTF-16 need ENC_ values */
|
||||
offset = dissect_counted_values (tvb, offset, hf_tnef_PropValue_lpszW, pinfo, prop_tree, TRUE, TRUE, ENC_NA);
|
||||
offset = dissect_counted_values (tvb, offset, hf_tnef_PropValue_lpszW, pinfo, prop_tree, TRUE, ENC_UTF_16|ENC_NA);
|
||||
break;
|
||||
case PT_CLSID:
|
||||
offset = nspi_dissect_struct_MAPIUID(tvb, offset, pinfo, prop_tree, &di, drep, hf_tnef_PropValue_lpguid, 0);
|
||||
|
|
Loading…
Reference in New Issue