aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ncp.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-05-25 12:44:06 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-05-25 12:44:06 +0000
commit7362c1914504e28b4108dc457135d54a8224bcea (patch)
tree737614b515dbd33141dfe52380b0d9619c5c7007 /packet-ncp.c
parentd2d5f3e7d749b233ddc30bdc37b8631a2aadac7d (diff)
If, when trying to get the length of an NCP-over-TCP PDU, we don't see
the right magic number at the beginning of the chunk of data, return the amount of data remaining as the length, rather than trusting the random word that follows to be a length usable for desegmentation. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5564 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-ncp.c')
-rw-r--r--packet-ncp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/packet-ncp.c b/packet-ncp.c
index 526b28a722..2283d02393 100644
--- a/packet-ncp.c
+++ b/packet-ncp.c
@@ -3,7 +3,7 @@
* Gilbert Ramirez <gram@alumni.rice.edu>
* Modified to allow NCP over TCP/IP decodes by James Coe <jammer@cin.net>
*
- * $Id: packet-ncp.c,v 1.63 2002/05/25 01:05:56 guy Exp $
+ * $Id: packet-ncp.c,v 1.64 2002/05/25 12:44:06 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -469,6 +469,18 @@ dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static guint
get_ncp_pdu_len(tvbuff_t *tvb, int offset)
{
+ guint32 signature;
+
+ /*
+ * Check the NCP-over-TCP header signature, to make sure it's there.
+ * If it's not there, we cannot trust the next 4 bytes to be a
+ * packet length+"has signature" flag, so we just say the length is
+ * "what remains in the packet".
+ */
+ signature = tvb_get_ntohl(tvb, offset);
+ if (signature != NCPIP_RQST && signature != NCPIP_RPLY)
+ return tvb_length_remaining(tvb, offset);
+
/*
* Get the length of the NCP-over-TCP packet. Strip off the "has
* signature" flag.