From: Jonathan Rose Date: Fri, 27 May 2011 14:59:34 +0000 (+0000) Subject: markm committed a patch I was working on yesterday, this fixes it to mesh up with... X-Git-Tag: 1.8.5-rc1~11^2~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a99d9c77704bb98366e9979c12dbbbf0330a6594;p=thirdparty%2Fasterisk.git markm committed a patch I was working on yesterday, this fixes it to mesh up with suggestions by mnicholson. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@321273 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/sip/reqresp_parser.c b/channels/sip/reqresp_parser.c index 0893c0f526..300acad5e5 100644 --- a/channels/sip/reqresp_parser.c +++ b/channels/sip/reqresp_parser.c @@ -42,25 +42,29 @@ int parse_uri_full(char *uri, const char *scheme, char **user, char **pass, char *c = NULL; int error = 0; + /* + * Initialize requested strings - some functions don't care if parse_uri fails + * and will attempt to use string pointers passed into parse_uri even after a + * parse_uri failure + */ + if (user) { + *user = ""; + } + if (pass) { + *pass = ""; + } + if (domain) { + *domain = ""; + } + if (headers) { + *headers = ""; + } + if (residue) { + *residue = ""; + } + /* 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; }