[asterisk-commits] twilson: trunk r341191 - in /trunk: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 17 12:38:57 CDT 2011


Author: twilson
Date: Mon Oct 17 12:38:53 2011
New Revision: 341191

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=341191
Log:
Initialize variables before calling parse_uri

If parse_uri was called with an empty URI, some pointers would be
modified and an invalid read could result. This patch avoids calling
parse_uri with an empty contact uri when parsing REGISTER requests. 

AST-2011-012

(closes issue ASTERISK-18668)
........

Merged revisions 341189 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 341190 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=341191&r1=341190&r2=341191
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Oct 17 12:38:53 2011
@@ -13820,7 +13820,7 @@
 	char data[SIPBUFSIZE];
 	const char *expires = sip_get_header(req, "Expires");
 	int expire = atoi(expires);
-	char *curi, *domain, *transport;
+	char *curi = NULL, *domain = NULL, *transport = NULL;
 	int transport_type;
 	const char *useragent;
 	struct ast_sockaddr oldsin, testsa;
@@ -13898,7 +13898,7 @@
 	ast_string_field_build(pvt, our_contact, "<%s>", curi);
 
 	/* Make sure it's a SIP URL */
-	if (parse_uri_legacy_check(curi, "sip:,sips:", &curi, NULL, &domain, &transport)) {
+	if (ast_strlen_zero(curi) || parse_uri_legacy_check(curi, "sip:,sips:", &curi, NULL, &domain, &transport)) {
 		ast_log(LOG_NOTICE, "Not a valid SIP contact (missing sip:/sips:) trying to use anyway\n");
 	}
 




More information about the asterisk-commits mailing list