aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mq.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-05-11 17:22:30 -0700
committerGuy Harris <guy@alum.mit.edu>2015-05-12 00:22:57 +0000
commit5862c94e901beb828125f39233cec2696ef14be2 (patch)
treef30bfb84bb6c6001d40bc9b0231997a09f22446c /epan/dissectors/packet-mq.c
parenta0046c344dc3e0a767eeb454056cdb7c4c0c5ce9 (diff)
In the name of God and all that is holy, don't do that.
http://www.bitterfilms.com/rejected.html 1) There is *NO* guarantee that you can safely dereference a misaligned pointer. 2) There is *NO* guarantee that you are running on a little-endian machine, so that an attempt to fetch a 32-bit integer through such a pointer will fetch it in little-endian form. Instead, fetch it using tvb_letohl(), which 1) doesn't care about alignment and 2) always fetches in little-endian order. Change-Id: I30ad6607b7c6d5047245bfcfdcbe757b02d02172 Reviewed-on: https://code.wireshark.org/review/8422 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-mq.c')
-rw-r--r--epan/dissectors/packet-mq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/epan/dissectors/packet-mq.c b/epan/dissectors/packet-mq.c
index df6c31e1c2..74668ebc7d 100644
--- a/epan/dissectors/packet-mq.c
+++ b/epan/dissectors/packet-mq.c
@@ -2807,8 +2807,8 @@ static void dissect_mq_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
if (p_mq_parm->mq_opcode == MQ_TST_MQCONN_REPLY)
{
- guint32 *pApp = (guint32 *)tvb_get_ptr(tvb, offset + 48 + 28, 4);
- if (*pApp <= 65536)
+ iApp = tvb_get_letohl(tvb, offset + 48 + 28);
+ if (iApp <= 65536)
iCod = ENC_LITTLE_ENDIAN;
else
iCod = ENC_BIG_ENDIAN;