diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-01-22 20:05:17 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-01-22 20:05:17 +0000 |
commit | 2019647757c9fd5f864a0041796e9623181a961c (patch) | |
tree | 7b4f43ce21cae73c69b69625f9338a3d6eeb81e8 /epan/dissectors/packet-aim.c | |
parent | 76131de4ab69d66a683516c159abdc34fe7a7138 (diff) |
At least according to
http://web.archive.org/web/20080308233204/http://dev.aol.com/aim/oscar/#SNAC
"In general strings are not NULL terminated and are encoded using UTF8."
It also says
Authentication
Over the years, the AIM backend has supported several different
methods for authentication. ...
When a client collects the loginId and password for the user it
should not normalize them in any manner. It also should not
prevent the user from entering certain characters as the AIM
name space is constantly changing. For example, currently the
AIM name space is ASCII based, but in the future that may
change. In general, the client should not perform input
checking and instead allow the backend to reject bad values.
which also suggests not assuming ASCII.
So use ENC_UTF_8 in most cases.
For actual messages, it says:
An IM can be encoded in the following different forms:
Name Value Notes
ASCII 0 ANSI ASCII -- ISO 646
UNICODE 2 ISO 10646.USC-2 Unicode
LATIN_1 3 ISO 8859-1
so, if that's the case, the dissector should choose beween
ENC_ASCII|ENC_NA, ENC_UCS_2|ENC_appropriate_ENDIAN, and
ENC_ISO_8859_1|ENC_NA.
Use tvb_get_string_enc() with an encoding rather than tvb_get_string().
svn path=/trunk/; revision=54908
Diffstat (limited to 'epan/dissectors/packet-aim.c')
-rw-r--r-- | epan/dissectors/packet-aim.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/epan/dissectors/packet-aim.c b/epan/dissectors/packet-aim.c index 49ca186914..8c293f51fc 100644 --- a/epan/dissectors/packet-aim.c +++ b/epan/dissectors/packet-aim.c @@ -827,7 +827,7 @@ dissect_aim_buddyname(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, tvb_format_text(tvb, offset, buddyname_length)); buddy_tree = proto_item_add_subtree(ti, ett_aim_buddyname); proto_tree_add_item(buddy_tree, hf_aim_buddyname_len, tvb, offset-1, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(buddy_tree, hf_aim_buddyname, tvb, offset, buddyname_length, ENC_ASCII|ENC_NA); + proto_tree_add_item(buddy_tree, hf_aim_buddyname, tvb, offset, buddyname_length, ENC_UTF_8|ENC_NA); } return offset+buddyname_length; @@ -1154,7 +1154,7 @@ dissect_aim_tlv_value_string (proto_item *ti, guint16 valueid _U_, tvbuff_t *tvb gint string_len; string_len = tvb_length(tvb); - buf = tvb_get_string(wmem_packet_scope(), tvb, 0, string_len); + buf = tvb_get_string_enc(wmem_packet_scope(), tvb, 0, string_len, ENC_UTF_8|ENC_NA); proto_item_set_text(ti, "Value: %s", format_text(buf, string_len)); return string_len; @@ -1171,7 +1171,7 @@ dissect_aim_tlv_value_string08_array (proto_item *ti, guint16 valueid _U_, tvbuf while (tvb_reported_length_remaining(tvb, offset) > 1) { guint8 string_len = tvb_get_guint8(tvb, offset++); - guint8 *buf = tvb_get_string(wmem_packet_scope(), tvb, offset, string_len); + guint8 *buf = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, string_len, ENC_UTF_8|ENC_NA); proto_tree_add_text(entry, tvb, offset, string_len, "%s", format_text(buf, string_len)); offset += string_len; @@ -1276,7 +1276,7 @@ dissect_aim_tlv_value_messageblock (proto_item *ti, guint16 valueid _U_, tvbuff_ offset += 2; /* The actual message */ - buf = tvb_get_string(wmem_packet_scope(), tvb, offset, blocklen - 4); + buf = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, blocklen - 4, ENC_ASCII|ENC_NA); proto_item_append_text(ti, "Message: %s ", format_text(buf, blocklen - 4)); proto_tree_add_item(entry, hf_aim_messageblock_message, tvb, |