forked from osmocom/wireshark
packet-dccp.c: Don't use tvb_get_ptr for getting a uint number.
Use the tvb_get_ntohXXX instead. Change-Id: I8d5c6ac2f2c8b1ac9237297f06709513fc2c9113 Reviewed-on: https://code.wireshark.org/review/21733 Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
8cdbde02c9
commit
d4725439c1
|
@ -315,24 +315,35 @@ decode_dccp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|||
* a concept by Arnaldo de Melo
|
||||
*/
|
||||
static guint64
|
||||
tvb_get_ntoh_var(tvbuff_t *tvb, gint offset, guint nbytes)
|
||||
dccp_ntoh_var(tvbuff_t *tvb, gint offset, guint nbytes)
|
||||
{
|
||||
const guint8 *ptr;
|
||||
guint64 value = 0;
|
||||
|
||||
ptr = tvb_get_ptr(tvb, offset, nbytes);
|
||||
if (nbytes > 5)
|
||||
value += ((guint64) * ptr++) << 40;
|
||||
if (nbytes > 4)
|
||||
value += ((guint64) * ptr++) << 32;
|
||||
if (nbytes > 3)
|
||||
value += ((guint64) * ptr++) << 24;
|
||||
if (nbytes > 2)
|
||||
value += ((guint64) * ptr++) << 16;
|
||||
if (nbytes > 1)
|
||||
value += ((guint64) * ptr++) << 8;
|
||||
if (nbytes > 0)
|
||||
value += *ptr;
|
||||
switch (nbytes)
|
||||
{
|
||||
case 5:
|
||||
value = tvb_get_ntoh40(tvb, offset);
|
||||
break;
|
||||
case 4:
|
||||
value = tvb_get_ntohl(tvb, offset);
|
||||
break;
|
||||
case 3:
|
||||
value = tvb_get_ntoh24(tvb, offset);
|
||||
break;
|
||||
case 2:
|
||||
value = tvb_get_ntohs(tvb, offset);
|
||||
break;
|
||||
case 1:
|
||||
value = tvb_get_guint8(tvb, offset);
|
||||
break;
|
||||
case 0:
|
||||
// do nothing
|
||||
break;
|
||||
case 6:
|
||||
default:
|
||||
value = tvb_get_ntoh48(tvb, offset);
|
||||
break;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -385,7 +396,7 @@ dissect_feature_options(proto_tree *dccp_options_tree, tvbuff_t *tvb,
|
|||
|
||||
if (option_len > 0) /* could be empty Confirm */
|
||||
proto_item_append_text(dccp_item, " %" G_GINT64_MODIFIER "u",
|
||||
tvb_get_ntoh_var(tvb, offset, option_len));
|
||||
dccp_ntoh_var(tvb, offset, option_len));
|
||||
break;
|
||||
|
||||
/* Reserved, specific, or unknown features */
|
||||
|
@ -469,8 +480,7 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo,
|
|||
expert_add_info_format(pinfo, option_item, &ei_dccp_option_len_bad,
|
||||
"NDP Count too long (max 6 bytes)");
|
||||
else
|
||||
proto_tree_add_uint64(option_tree, hf_dccp_ndp_count, tvb, offset, option_len,
|
||||
tvb_get_ntoh_var(tvb, offset, option_len));
|
||||
proto_tree_add_item(option_tree, hf_dccp_ndp_count, tvb, offset, option_len, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
case 38:
|
||||
proto_tree_add_item(option_tree, hf_dccp_ack_vector_nonce_0, tvb, offset, option_len, ENC_NA);
|
||||
|
|
Loading…
Reference in New Issue