[asterisk-commits] markm: branch 1.8 r321155 - in /branches/1.8/channels: ./ sip/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 26 16:48:51 CDT 2011


Author: markm
Date: Thu May 26 16:48:45 2011
New Revision: 321155

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=321155
Log:
Fixed build problem with dev mode enabled, which was caused by commit 321100.  Reformulated patch to be more generic.

Moved the sip uri parse variable initalization to parse_uri_full in reqresp_parser.c.  This will ensure that any use of parse uri will have null output variables if the parse fails.

(closes issue #19346)
Reported by: kobaz
Tested by: kobaz,JonathanRose

Review: [full review board URL with trailing slash]

Modified:
    branches/1.8/channels/chan_sip.c
    branches/1.8/channels/sip/reqresp_parser.c

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=321155&r1=321154&r2=321155
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Thu May 26 16:48:45 2011
@@ -13287,21 +13287,8 @@
 }
 
 /*! \brief parse uri in a way that allows semicolon stripping if legacy mode is enabled */
-static int parse_uri_legacy_check(char *uri, const char *scheme, char **user, char **pass, char **domain, char **transport) {
-	/* Assume invalid to start */
-	if (user) {
-		*user = 0;
-	}
-	if (pass) {
-		*pass = 0;
-	}
-	if (domain) {
-		*domain = 0;
-	}
-	if (transport) {
-		*transport = 0;
-	}
-
+static int parse_uri_legacy_check(char *uri, const char *scheme, char **user, char **pass, char **domain, char **transport)
+{
 	int ret = parse_uri(uri, scheme, user, pass, domain, transport);
 	if (sip_cfg.legacy_useroption_parsing) { /* if legacy mode is active, strip semis from the user field */
 		char *p;

Modified: branches/1.8/channels/sip/reqresp_parser.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/sip/reqresp_parser.c?view=diff&rev=321155&r1=321154&r2=321155
==============================================================================
--- branches/1.8/channels/sip/reqresp_parser.c (original)
+++ branches/1.8/channels/sip/reqresp_parser.c Thu May 26 16:48:45 2011
@@ -44,6 +44,23 @@
 
 	/* check for valid input */
 	if (ast_strlen_zero(uri)) {
+		/* make sure we leave nothing undefined after we exit */
+		if (user) {
+			*user = "";
+		}
+		if (pass) {
+			*pass = "";
+		}
+		if (domain) {
+			*domain = "";
+		}
+		if (headers) {
+			*headers = "";
+		}
+		if (residue) {
+			*residue = "";
+		}
+
 		return -1;
 	}
 




More information about the asterisk-commits mailing list