diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 4aca9b59e7..82dfef76e4 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -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; diff --git a/channels/sip/reqresp_parser.c b/channels/sip/reqresp_parser.c index 60dcfba554..0893c0f526 100644 --- a/channels/sip/reqresp_parser.c +++ b/channels/sip/reqresp_parser.c @@ -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; }