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
This commit is contained in:
Guy Harris 2014-01-22 20:51:56 +00:00
parent dd8cf3de90
commit 222296999b
1 changed files with 12 additions and 8 deletions

View File

@ -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);
}