diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-04-09 23:06:47 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-04-10 14:55:45 +0000 |
commit | c7970d9356a494d847101c2bd92e4ca97a7d3d58 (patch) | |
tree | e894b469ecc2c26563fbce3a9512af9bad66c594 /plugins | |
parent | 2cb93e2121eea20c1e443558d7175f1cab8e1f70 (diff) |
Add, and use, "fetch signed value" for lengths < 40 bits.
Add 8-bit, 16-bit, 24-bit, and 32-bit "fetch signed value" routines, and
use them rather than casting the result of the 8/16/24/32-bit "fetch
unsigned value" routines to a signed type (which, BTW, isn't sufficient
for 24-bit values, so this appears to fix a bug
in epan/dissectors/packet-zbee-zcl.c).
Use numbers rather than sizeof()s in various tvb_get_ routines.
Change-Id: I0e48a57fac9f70fe42de815c3fa915f1592548bd
Reviewed-on: https://code.wireshark.org/review/26844
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/epan/wimax/msg_fpc.c | 2 | ||||
-rw-r--r-- | plugins/epan/wimax/msg_pmc.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/plugins/epan/wimax/msg_fpc.c b/plugins/epan/wimax/msg_fpc.c index 3ff23dc655..325103ae8c 100644 --- a/plugins/epan/wimax/msg_fpc.c +++ b/plugins/epan/wimax/msg_fpc.c @@ -67,7 +67,7 @@ static int dissect_mac_mgmt_msg_fpc_decoder(tvbuff_t *tvb, packet_info *pinfo _U offset += 2; /* display the Power adjust value */ - value = (gint8)tvb_get_guint8(tvb, offset); + value = tvb_get_gint8(tvb, offset); power_change = (float)0.25 * value; /* 0.25dB incr */ /* display the Power adjust value in dB */ diff --git a/plugins/epan/wimax/msg_pmc.c b/plugins/epan/wimax/msg_pmc.c index 6a68644f82..9077d635f4 100644 --- a/plugins/epan/wimax/msg_pmc.c +++ b/plugins/epan/wimax/msg_pmc.c @@ -206,7 +206,7 @@ static int dissect_mac_mgmt_msg_pmc_rsp_decoder(tvbuff_t *tvb, packet_info *pinf pwr_control_mode = 0xC0 & tvb_get_guint8(tvb, offset); offset++; - value = (gint8)tvb_get_guint8(tvb, offset); + value = tvb_get_gint8(tvb, offset); power_change = (float)0.25 * value; /* 0.25dB incr */ /* Check if Power Control Mode is 0 */ if (pwr_control_mode == 0) { |