diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-03-10 08:41:02 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-03-10 08:41:02 +0000 |
commit | 156b135d014349fc0322418e1f6cfbb9edc40535 (patch) | |
tree | 3a40240a62187a4c9fa964dcafd48116ec68f47d /packet-rsvp.c | |
parent | 5a89694778365ed68eeb1a36512b5f8d0cd1b5e3 (diff) |
"ulong" is not a system-declared data type on all platforms;
casting an arbitrary pointer into a frame to point to something
longer than 1 byte, and dereferencing it, is dangerous, as
there's no guarantee that said pointer is properly aligned on
machines that require alignment;
the data in an RSVP packet is presumably big-endian in any case,
so you should use "pntohl()" to access it, rather than just
blithely dereferencing it;
so use "pntohl()" to extract fields from an RSVP packet rather than
casting pointers to "ulong *" and dereferencing them.
svn path=/trunk/; revision=1709
Diffstat (limited to 'packet-rsvp.c')
-rw-r--r-- | packet-rsvp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packet-rsvp.c b/packet-rsvp.c index 9c19f410fd..2287ffcaf5 100644 --- a/packet-rsvp.c +++ b/packet-rsvp.c @@ -3,7 +3,7 @@ * * (c) Copyright Ashok Narayanan <ashokn@cisco.com> * - * $Id: packet-rsvp.c,v 1.15 2000/03/09 18:31:51 ashokn Exp $ + * $Id: packet-rsvp.c,v 1.16 2000/03/10 08:41:02 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -919,7 +919,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_text(rsvp_object_tree, offset+3, 1, "C-type: 1 - IPv4"); proto_tree_add_item(rsvp_object_tree, rsvp_filter[RSVPF_SESSION_IP], - offset2, 4, *(ulong *)(pd+offset2)); + offset2, 4, pntohl(pd+offset2)); proto_tree_add_item(rsvp_object_tree, rsvp_filter[RSVPF_SESSION_PROTO], offset2+4, 1, *(pd+offset2+4)); @@ -951,12 +951,12 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_text(rsvp_object_tree, offset+3, 1, "C-type: 7 - IPv4 LSP"); proto_tree_add_item(rsvp_object_tree, rsvp_filter[RSVPF_SESSION_IP], - offset2, 4, *(ulong *)(pd+offset2)); + offset2, 4, pntohl(pd+offset2)); proto_tree_add_item(rsvp_object_tree, rsvp_filter[RSVPF_SESSION_TUNNEL_ID], offset2+6, 2, pntohs(pd+offset2+6)); proto_tree_add_item(rsvp_object_tree, rsvp_filter[RSVPF_SESSION_EXT_TUNNEL_ID], - offset2+8, 4, *(ulong *)(pd+offset2+8)); + offset2+8, 4, pntohl(pd+offset2+8)); break; } @@ -1247,7 +1247,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_text(rsvp_object_tree, offset+3, 1, "C-type: 1 - IPv4"); proto_tree_add_item(rsvp_object_tree, rsvp_filter[RSVPF_SENDER_IP], - offset2, 4, *(ulong *)(pd+offset2)); + offset2, 4, pntohl(pd+offset2)); proto_tree_add_item(rsvp_object_tree, rsvp_filter[RSVPF_SENDER_PORT], offset2+6, 2, pntohs(pd+offset2+6)); @@ -1270,7 +1270,7 @@ dissect_rsvp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_text(rsvp_object_tree, offset+3, 1, "C-type: 7 - IPv4 LSP"); proto_tree_add_item(rsvp_object_tree, rsvp_filter[RSVPF_SENDER_IP], - offset2, 4, *(ulong *)(pd+offset2)); + offset2, 4, pntohl(pd+offset2)); proto_tree_add_item(rsvp_object_tree, rsvp_filter[RSVPF_SENDER_LSP_ID], offset2+6, 2, pntohs(pd+offset2+6)); |