[asterisk-commits] oej: branch 1.6.0 r114900 - in /branches/1.6.0: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 30 12:06:18 CDT 2008


Author: oej
Date: Wed Apr 30 12:06:18 2008
New Revision: 114900

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114900
Log:
Merged revisions 114899 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r114899 | oej | 2008-04-30 18:55:49 +0200 (Ons, 30 Apr 2008) | 15 lines

Merged revisions 114890 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114890 | oej | 2008-04-30 18:23:17 +0200 (Ons, 30 Apr 2008) | 7 lines

Don't crash on bad SIP replys.
Fix created in Huntsville together with Mark M (putnopvut)

(closes issue #12363)
Reported by: jvandal
Tested by: putnopvut, oej

........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/channels/chan_sip.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=114900&r1=114899&r2=114900
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Wed Apr 30 12:06:18 2008
@@ -1925,7 +1925,7 @@
 static const char *gettag(const struct sip_request *req, const char *header, char *tagbuf, int tagbufsize);
 static int find_sip_method(const char *msg);
 static unsigned int parse_sip_options(struct sip_pvt *pvt, const char *supported);
-static void parse_request(struct sip_request *req);
+static int parse_request(struct sip_request *req);
 static const char *get_header(const struct sip_request *req, const char *name);
 static const char *referstatus2str(enum referstatus rstatus) attribute_pure;
 static int method_match(enum sipmethod id, const char *name);
@@ -6124,7 +6124,7 @@
 /*! \brief Parse a SIP message 
 	\note this function is used both on incoming and outgoing packets
 */
-static void parse_request(struct sip_request *req)
+static int parse_request(struct sip_request *req)
 {
 	char *c = req->data, **dst = req->header;
 	int i = 0, lim = SIP_MAX_HEADERS - 1;
@@ -6174,7 +6174,7 @@
 	if (*c)
 		ast_log(LOG_WARNING, "Too many lines, skipping <%s>\n", c);
 	/* Split up the first line parts */
-	determine_firstline_parts(req);
+	return determine_firstline_parts(req);
 }
 
 /*!
@@ -18074,7 +18074,11 @@
 			ntohs(sin->sin_port), req->data);
 	}
 
-	parse_request(req);
+	if(parse_request(req) == -1) { /* Bad packet, can't parse */
+		ast_str_reset(req->data); /* nulling this out is NOT a good idea here. */
+		return 1;
+	}
+
 	req->method = find_sip_method(req->rlPart1);
 
 	if (req->debug)




More information about the asterisk-commits mailing list