aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Deniel <laurent.deniel@free.fr>1999-10-02 16:58:41 +0000
committerLaurent Deniel <laurent.deniel@free.fr>1999-10-02 16:58:41 +0000
commit3d597048777b2fc444795b46e5d5024aa30462d1 (patch)
tree15cc62f89564192d7de146807df8f77234ae3abe
parent6269de2c37dc7e185a5351f6503ec9ab96ee5b22 (diff)
Check for truncated header.
svn path=/trunk/; revision=752
-rw-r--r--packet-udp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/packet-udp.c b/packet-udp.c
index 4370715f76..f06d9e91b6 100644
--- a/packet-udp.c
+++ b/packet-udp.c
@@ -1,7 +1,7 @@
/* packet-udp.c
* Routines for UDP packet disassembly
*
- * $Id: packet-udp.c,v 1.24 1999/09/14 08:06:23 guy Exp $
+ * $Id: packet-udp.c,v 1.25 1999/10/02 16:58:41 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -174,7 +174,11 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
proto_tree *udp_tree;
proto_item *ti;
- /* To do: Check for {cap len,pkt len} < struct len */
+ if (!BYTES_ARE_IN_FRAME(offset, sizeof(e_udphdr))) {
+ dissect_data(pd, offset, fd, tree);
+ return;
+ }
+
/* Avoids alignment problems on many architectures. */
memcpy(&uh, &pd[offset], sizeof(e_udphdr));
uh_sport = ntohs(uh.uh_sport);