diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-01-22 20:51:56 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-01-22 20:51:56 +0000 |
commit | 222296999b1897d26774928134fad76027449b4a (patch) | |
tree | 86ad1d2638df406e42f53d71b5d5f8d3fbe86e4d /epan/dissectors/packet-amqp.c | |
parent | dd8cf3de9012b57ffd56656cc57ce033ee3274f7 (diff) |
Use tvb_get_string_enc() with appropriate encodings rather than
tvb_get_string(). (Some versions of the spec speak of ISO 8859-15
strings as well as UTF-8 strings, but we don't appear to try to handle
those.)
Update spec URL.
svn path=/trunk/; revision=54910
Diffstat (limited to 'epan/dissectors/packet-amqp.c')
-rw-r--r-- | epan/dissectors/packet-amqp.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/epan/dissectors/packet-amqp.c b/epan/dissectors/packet-amqp.c index 8f128dbafa..bf6ed1edc4 100644 --- a/epan/dissectors/packet-amqp.c +++ b/epan/dissectors/packet-amqp.c @@ -32,7 +32,7 @@ /* * See * - * http://www.amqp.org/confluence/display/AMQP/AMQP+Specification + * http://www.amqp.org/resources/download * * for specifications for various versions of the AMQP protocol. */ @@ -2915,7 +2915,7 @@ dissect_amqp_0_9_field_table(tvbuff_t *tvb, packet_info *pinfo, int offset, guin length -= 1; if (length < namelen) goto too_short; - name = (char*) tvb_get_string(wmem_packet_scope(), tvb, offset, namelen); + name = (char*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, namelen, ENC_UTF_8|ENC_NA); offset += namelen; length -= namelen; if (length < 1) @@ -2933,7 +2933,11 @@ dissect_amqp_0_9_field_table(tvbuff_t *tvb, packet_info *pinfo, int offset, guin length -= 4; if (length < vallen) goto too_short; - value = (char*) tvb_get_string(wmem_packet_scope(), tvb, offset, vallen); + /* + * The spec says a long string can contain "any data"; could + * this be binary? + */ + value = (char*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, vallen, ENC_UTF_8|ENC_NA); offset += vallen; length -= vallen; break; @@ -3047,7 +3051,7 @@ dissect_amqp_0_10_map(tvbuff_t *tvb, namelen = tvb_get_guint8(tvb, offset); AMQP_INCREMENT(offset, 1, bound); length -= 1; - name = (char*) tvb_get_string(wmem_packet_scope(), tvb, offset, namelen); + name = (char*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, namelen, ENC_UTF_8|ENC_NA); AMQP_INCREMENT(offset, namelen, bound); length -= namelen; type = tvb_get_guint8(tvb, offset); @@ -3164,7 +3168,7 @@ dissect_amqp_0_10_array(tvbuff_t *tvb, len16 = tvb_get_ntohs(tvb, offset); AMQP_INCREMENT(offset, 2, bound); length -= 2; - value = (char*) tvb_get_string(wmem_packet_scope(), tvb, offset, len16); + value = (char*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, len16, ENC_UTF_8|ENC_NA); AMQP_INCREMENT(offset, len16, bound); length -= len16; break; @@ -10607,7 +10611,7 @@ format_amqp_1_0_str(tvbuff_t *tvb, return length; } AMQP_INCREMENT(offset, length, bound); - *value = tvb_get_string(wmem_packet_scope(), tvb, offset, string_length); + *value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, string_length, ENC_UTF_8|ENC_NA); AMQP_INCREMENT(offset, string_length, bound); return (string_length + length); } @@ -10627,7 +10631,7 @@ format_amqp_1_0_symbol(tvbuff_t *tvb, return length; } AMQP_INCREMENT(offset, length, bound); - *value = tvb_get_string(wmem_packet_scope(), tvb, offset, symbol_length); + *value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, symbol_length, ENC_ASCII|ENC_NA); AMQP_INCREMENT(offset, symbol_length, bound); return (symbol_length + length); } @@ -10772,7 +10776,7 @@ format_amqp_0_10_str(tvbuff_t *tvb, return length; } AMQP_INCREMENT(offset, length, bound); - *value = tvb_get_string(wmem_packet_scope(), tvb, offset, string_length); + *value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, string_length, ENC_UTF_8|ENC_NA); AMQP_INCREMENT(offset, string_length, bound); return (string_length + length); } |