[asterisk-commits] markm: trunk r321101 - in /trunk: ./ channels/chan_sip.c main/netsock2.c

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


Author: markm
Date: Thu May 26 15:16:28 2011
New Revision: 321101

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=321101
Log:
Merged revisions 321100 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r321100 | markm | 2011-05-26 16:09:35 -0400 (Thu, 26 May 2011) | 11 lines
  
  ast_sockaddr_resolve() in netsock2.c may deref a null pointer
  
  Added a null check in netsock2 ast_sockaddr_resolve() as well as added default initalizers in chan_sip parse_uri_legacy_check() to make sure that invalid uris will make null (and not undefined) user,pass,domain,transport variables
  
  (closes issue #19346)
  Reported by: kobaz
  Patches: 
        netsock2.patch uploaded by kobaz (license 834)
  Tested by: kobaz, Marquis
........

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

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-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=321101&r1=321100&r2=321101
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu May 26 15:16:28 2011
@@ -13551,6 +13551,20 @@
 
 /*! \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;
+	}
+
 	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: trunk/main/netsock2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/netsock2.c?view=diff&rev=321101&r1=321100&r2=321101
==============================================================================
--- trunk/main/netsock2.c (original)
+++ trunk/main/netsock2.c Thu May 26 15:16:28 2011
@@ -232,6 +232,10 @@
 	char *s, *host, *port;
 	int	e, i, res_cnt;
 
+	if (!str) {
+		return 0;
+	}
+
 	s = ast_strdupa(str);
 	if (!ast_sockaddr_split_hostport(s, &host, &port, flags)) {
 		return 0;




More information about the asterisk-commits mailing list