aboutsummaryrefslogtreecommitdiffstats
path: root/packet-sip.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-05-09 07:42:07 +0000
committerGuy Harris <guy@alum.mit.edu>2002-05-09 07:42:07 +0000
commitc9c26fce69b99d9780b40ce191e8f46b337f63e6 (patch)
tree318edeb0dafb441744df7fd8ad6b691cbd6c37eb /packet-sip.c
parentcbad622d0eea2ddc0f663c03fd1c8383d3bf0dd7 (diff)
In the heuristic dissector, check to make sure the data being looked at
is available before looking at it, so we don't throw an exception before we conclude whether the packet is, or isn't, one of ours. svn path=/trunk/; revision=5424
Diffstat (limited to 'packet-sip.c')
-rw-r--r--packet-sip.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/packet-sip.c b/packet-sip.c
index 4f3e2f063b..2fca273ba8 100644
--- a/packet-sip.c
+++ b/packet-sip.c
@@ -15,7 +15,7 @@
* Copyright 2000, Heikki Vatiainen <hessu@cs.tut.fi>
* Copyright 2001, Jean-Francois Mule <jfm@clarent.com>
*
- * $Id: packet-sip.c,v 1.27 2002/05/08 20:29:46 guy Exp $
+ * $Id: packet-sip.c,v 1.28 2002/05/09 07:42:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -187,11 +187,23 @@ dissect_sip_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* So we first check if the frame is really meant for us.
*/
- /* check for a request */
+ /*
+ * Check for a request.
+ * First, make sure we have enough data to do the check.
+ */
+ if (!tvb_bytes_exist(tvb, 0, SIP2_HDR_LEN)) {
+ /*
+ * We don't.
+ */
+ return FALSE;
+ }
+ /*
+ * Now see if we have a request header.
+ */
if (tvb_strneql(tvb, 0, SIP2_HDR, SIP2_HDR_LEN) != 0) {
/*
- * Not a request; check for a response.
+ * We don't, so this isn't a request; check for a response.
*/
eol = tvb_find_line_end(tvb, 0, -1, &next_offset);
if ((eol > (gint)SIP2_HDR_LEN) &&