aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-lbmc.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-05-11 19:40:59 -0700
committerGuy Harris <guy@alum.mit.edu>2015-05-12 02:42:58 +0000
commit2693e1d1081ac8a5f3cf15b5961d0229775e25e6 (patch)
tree4500386729c34b311c17a3306c8719169e5e19aa /epan/dissectors/packet-lbmc.c
parent5862c94e901beb828125f39233cec2696ef14be2 (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_get_letohl(), which 1) doesn't care about alignment and 2) always fetches in little-endian order. Change-Id: I44721cbf3c4456797990cc741836c9dd8c6c3696 Reviewed-on: https://code.wireshark.org/review/8423 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-lbmc.c')
-rw-r--r--epan/dissectors/packet-lbmc.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/epan/dissectors/packet-lbmc.c b/epan/dissectors/packet-lbmc.c
index 40203adc50..46fd8537e8 100644
--- a/epan/dissectors/packet-lbmc.c
+++ b/epan/dissectors/packet-lbmc.c
@@ -10075,8 +10075,6 @@ static int dissect_msg_properties(tvbuff_t * tvb, int offset, packet_info * pinf
proto_item * field_item = NULL;
proto_tree * field_tree = NULL;
guint32 magic;
- guint32 * magic_ptr = NULL;
- char magic_char[4];
guint16 num_fields;
guint16 idx;
guint encoding;
@@ -10084,9 +10082,7 @@ static int dissect_msg_properties(tvbuff_t * tvb, int offset, packet_info * pinf
int data_length;
proto_item * magic_item = NULL;
- tvb_memcpy(tvb, (void *)magic_char, offset + O_LBM_MSG_PROPERTIES_DATA_T_MAGIC, 4);
- magic_ptr = (guint32 *)magic_char;
- magic = *magic_ptr;
+ magic = tvb_get_letohl(tvb, offset + O_LBM_MSG_PROPERTIES_DATA_T_MAGIC);
encoding = ENC_LITTLE_ENDIAN;
if (magic == LBM_MSG_PROPERTIES_MAGIC)
{