From 4ef8ba6324ae7f9d9ce8d94c2f1ba7457e0b9f4c Mon Sep 17 00:00:00 2001 From: Martin Mathieson Date: Tue, 23 Apr 2013 22:44:23 +0000 Subject: [PATCH] Add a quick check for a first printable character to avoid a more expensive check of the whole first line. This gets called a lot as a heuristic dissector. svn path=/trunk/; revision=49006 --- epan/dissectors/packet-sip.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index ea622eeb68..b1d08b2cf7 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -2118,6 +2118,17 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr guint32 response_time = 0; int strlen_to_copy; + /* + * If this should be a request of response, do this quick check to see if + * it begins with a string... + * Otherwise, SIP heuristics are expensive... + * + */ + if (!dissect_other_as_continuation && + ((tvb_reported_length_remaining(tvb, offset) < 1) || !isprint(tvb_get_guint8(tvb, offset)))) + { + return -2; + } /* * Note that "tvb_find_line_end()" will return a value that