diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-03-28 15:28:12 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-03-28 15:28:12 +0000 |
commit | bbf2beaa537207c0320d8d24c8554aaf536daf83 (patch) | |
tree | 002f8472663ac115402a60c898c5189d7fbbae85 /epan/dissectors/packet-ua3g.c | |
parent | 64f0e71d070b329a8f0a7814ff30d21dd3bd2db8 (diff) |
Fix Coverity CID's 281433 and 281434: Unintended sign extension. (18 instances)
Fix Coverity CID 702381: Missing break in switch.
Add an "XXX" note regarding the framing_rtp assignment, since something appears to be missing.
#BACKPORT(1.8)
svn path=/trunk/; revision=48620
Diffstat (limited to 'epan/dissectors/packet-ua3g.c')
-rw-r--r-- | epan/dissectors/packet-ua3g.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/epan/dissectors/packet-ua3g.c b/epan/dissectors/packet-ua3g.c index 2b13aa977d..c2c57984c5 100644 --- a/epan/dissectors/packet-ua3g.c +++ b/epan/dissectors/packet-ua3g.c @@ -808,8 +808,9 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo if (parameter_length <= 8) { guint64 param_value = 0; + for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append(strbuf, val_to_str_const((guint8)(param_value), str_compressor, "Default Codec")); } else { @@ -830,7 +831,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append(strbuf, STR_ON_OFF((guint8)(param_value))); } else { @@ -848,7 +849,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } /* XXX: Only 0x01 ==> "Yes" ?? */ ep_strbuf_append(strbuf, ((guint8)param_value == 0x01) ? "Yes": "No"); @@ -872,7 +873,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append(strbuf, ((guint8)param_value) ? "Send DTMF" : "Don't Send DTMF"); } else { @@ -890,7 +891,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append(strbuf, (((guint8)param_value) == 0x00) ? "Enable" : "Disable"); /* XXX: OK ? */ } else { @@ -908,7 +909,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append(strbuf, (((guint8)param_value) == 0x10) ? "Enable" : "Disable"); } else { @@ -946,7 +947,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); } else { @@ -1021,9 +1022,8 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo if (parameter_length <= 8) { guint64 param_value = 0; - for (i = parameter_length; i > 0; i--) - { - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + for (i = parameter_length; i > 0; i--) { + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); } else { @@ -1102,7 +1102,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); } else { @@ -1299,7 +1299,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); } else { @@ -1506,7 +1506,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo { if ((parameter_length > 0) && (parameter_length <= 8)) { for (i = parameter_length; i > 0; i--) { - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); } else if (parameter_length > 8) { @@ -1578,7 +1578,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); } else { @@ -1677,7 +1677,7 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); } else { @@ -3727,7 +3727,7 @@ decode_cs_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append(strbuf, val_to_str_const((guint8)(param_value), str_compressor, "Default Codec")); @@ -3781,7 +3781,7 @@ decode_cs_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { - param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); } ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); } else { @@ -3963,7 +3963,7 @@ decode_cs_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ - param_value += (tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i))); } ep_strbuf_append(strbuf, val_to_str_const((guint8)(param_value), str_compressor, "Default Codec")); @@ -3996,7 +3996,7 @@ decode_cs_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ - param_value += (tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i))); } ep_strbuf_append(strbuf, val_to_str_const((guint8)(param_value), str_voice_mode, "Unknown")); @@ -4143,7 +4143,9 @@ decode_cs_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, } case 0x14: /* Received Framing (ms) */ { + /* XXX: What is the point of this assignment? */ framing_rtp = tvb_get_guint8(tvb, offset + 3); + /* FALLTHROUGH */ } case 0x01: /* Date Of End Of Communication */ case 0x02: /* Node Number */ @@ -4169,7 +4171,7 @@ decode_cs_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, guint64 param_value = 0; for (i = parameter_length; i > 0; i--) { - param_value += (tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i))); + param_value += ((guint64)tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i))); } ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); break; |