aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-24 07:14:17 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-24 07:14:17 +0000
commit563bb3a37f87a78a668182d0eeebdb8e6b9007e5 (patch)
treefaed1d583f733ce7aefbb02582821da9f269d4b6 /channels
parent10d0d0bdcc3bef6c339489e754d8a50d25f06905 (diff)
merge 46045 prevent NULL args to ast_strdupa() in chan_sip.c
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46114 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a67395b14..7060d4b2d 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1627,12 +1627,13 @@ static int find_sip_method(const char *msg)
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 @@ static int sip_transfer(struct ast_channel *ast, const char *dest)
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 @@ static int sip_devicestate(void *data)
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 @@ static int sip_sipredirect(struct sip_pvt *p, const char *dest)
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;
}