]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixed build problem with dev mode enabled, which was caused by commit 321100. Reform...
authorMark Murawki <markm@intellasoft.net>
Thu, 26 May 2011 21:48:45 +0000 (21:48 +0000)
committerMark Murawki <markm@intellasoft.net>
Thu, 26 May 2011 21:48:45 +0000 (21:48 +0000)
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]

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@321155 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
channels/sip/reqresp_parser.c

index 4aca9b59e7cbc0a6a3aadd71081cb0f0daba6c90..82dfef76e49e63cfa17fad039ff899b9c59f6329 100644 (file)
@@ -13287,21 +13287,8 @@ static int parse_ok_contact(struct sip_pvt *pvt, struct sip_request *req)
 }
 
 /*! \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;
index 60dcfba55422fd38410c1424097247cb921a86e9..0893c0f5262fadb08de5cb80dc0eea19d278dfa2 100644 (file)
@@ -44,6 +44,23 @@ int parse_uri_full(char *uri, const char *scheme, char **user, char **pass,
 
        /* 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;
        }