aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-hip.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2012-01-12 20:40:23 +0000
committerBill Meier <wmeier@newsguy.com>2012-01-12 20:40:23 +0000
commit34a0aba9d36b1bd1ce004321c8269dc9dd5a2721 (patch)
treee6dee0ed8a13d9b01357ae4b96fd5d4803cfe265 /epan/dissectors/packet-hip.c
parentf6ffb03ccbb2202d4a789aef955d4401692e546d (diff)
Don't do fcn calls in arg of g_?to??(); Macro may very well eval args multiple times.
svn path=/trunk/; revision=40444
Diffstat (limited to 'epan/dissectors/packet-hip.c')
-rw-r--r--epan/dissectors/packet-hip.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/epan/dissectors/packet-hip.c b/epan/dissectors/packet-hip.c
index 36f82b521b..35b26ab8d8 100644
--- a/epan/dissectors/packet-hip.c
+++ b/epan/dissectors/packet-hip.c
@@ -395,7 +395,7 @@ dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 phdr[2];
/* Payload format RFC 5201 section 5.1 */
- /* hiph_proto; */ /* payload protocol */
+ /* hiph_proto; */ /* payload protocol */
guint8 hiph_hdr_len; /* header length */
guint8 hiph_shim6_fixed_bit_s; /* This is always 0 */
guint8 hiph_packet_type; /* packet type */
@@ -412,7 +412,7 @@ dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_clear(pinfo->cinfo, COL_INFO);
newoffset = offset;
- /* hiph Proto */
+ /* hiph Proto */
newoffset++;
hiph_hdr_len = tvb_get_guint8(tvb, newoffset);
newoffset++;
@@ -467,12 +467,14 @@ dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* the rest of the pseudo-header */
if (pinfo->src.type == AT_IPv6) {
cksum_vec[2].ptr = (const guint8 *)&phdr;
- phdr[0] = g_htonl(tvb_reported_length(tvb));
+ phdr[0] = tvb_reported_length(tvb);
+ phdr[0] = g_htonl(phdr[0]); /* Note: g_htonl() macro may eval arg multiple times */
phdr[1] = g_htonl(IP_PROTO_HIP);
cksum_vec[2].len = 8;
} else {
cksum_vec[2].ptr = (const guint8 *)&phdr;
- phdr[0] = g_htonl((IP_PROTO_HIP<<16)+tvb_reported_length(tvb));
+ phdr[0] = (IP_PROTO_HIP<<16)+tvb_reported_length(tvb);
+ phdr[0] = g_htonl(phdr[0]); /* Note: g_htonl() macro may eval arg multiple times */
cksum_vec[2].len = 4;
}
/* pointer to the HIP header (packet data) */