[svn-commits] rizzo: branch 1.4 r46114 - /branches/1.4/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Oct 24 00:14:17 MST 2006


Author: rizzo
Date: Tue Oct 24 02:14:17 2006
New Revision: 46114

URL: http://svn.digium.com/view/asterisk?rev=46114&view=rev
Log:
merge 46045   prevent NULL args to ast_strdupa() in chan_sip.c


Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?rev=46114&r1=46113&r2=46114&view=diff
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Tue Oct 24 02:14:17 2006
@@ -1627,12 +1627,13 @@
 static unsigned int parse_sip_options(struct sip_pvt *pvt, const char *supported)
 {
 	char *next, *sep;
-	char *temp = ast_strdupa(supported);
+	char *temp;
 	unsigned int profile = 0;
 	int i, found;
 
 	if (ast_strlen_zero(supported) )
 		return 0;
+	temp = ast_strdupa(supported);
 
 	if (option_debug > 2 && sipdebug)
 		ast_log(LOG_DEBUG, "Begin: parsing SIP \"Supported: %s\"\n", supported);
@@ -3562,6 +3563,8 @@
 	struct sip_pvt *p = ast->tech_pvt;
 	int res;
 
+	if (dest == NULL)	/* functions below do not take a NULL */
+		dest = "";
 	ast_mutex_lock(&p->lock);
 	if (ast->_state == AST_STATE_RING)
 		res = sip_sipredirect(p, dest);
@@ -14848,7 +14851,8 @@
 
 	int res = AST_DEVICE_INVALID;
 
-	host = ast_strdupa(data);
+	/* make sure data is not null. Maybe unnecessary, but better be safe */
+	host = ast_strdupa(data ? data : "");
 	if ((tmp = strchr(host, '@')))
 		host = tmp + 1;
 
@@ -16613,7 +16617,7 @@
 	extension = strsep(&cdest, "@");
 	host = strsep(&cdest, ":");
 	port = strsep(&cdest, ":");
-	if (!extension) {
+	if (ast_strlen_zero(extension)) {
 		ast_log(LOG_ERROR, "Missing mandatory argument: extension\n");
 		return 0;
 	}



More information about the svn-commits mailing list