summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-07-06 01:45:23 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-07-06 01:45:23 +0000
commit1bd88c387e3e90f5a3231d136dda6dd019501a61 (patch)
tree11c74f5e3b1b8217fc4feb43227f1df8aeeb1638 /channels
parent8b19bdba36fdde8e02f689bf0dcdec7ed1172414 (diff)
don't segfault when peer doesn't send Referred-By (bug #4588)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6038 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_sip.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 6b4e40d21..a5091e73e 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -5909,9 +5909,11 @@ static int get_refer_info(struct sip_pvt *sip_pvt, struct sip_request *outgoing_
referred_by = NULL;
}
- refer_to += 4;
- referred_by += 4;
-
+ if (refer_to)
+ refer_to += 4;
+
+ if (referred_by)
+ referred_by += 4;
if ((ptr = strchr(refer_to, '?'))) {
/* Search for arguments */
@@ -5982,7 +5984,8 @@ static int get_refer_info(struct sip_pvt *sip_pvt, struct sip_request *outgoing_
ast_log(LOG_DEBUG,"Transferred by (Referred-by: ) %s \n", referred_by);
ast_log(LOG_DEBUG,"Transfer Contact Info %s (REFER_CONTACT)\n", h_contact);
ast_copy_string(sip_pvt->refer_to, refer_to, sizeof(sip_pvt->refer_to));
- ast_copy_string(sip_pvt->referred_by, referred_by, sizeof(sip_pvt->referred_by));
+ if (referred_by)
+ ast_copy_string(sip_pvt->referred_by, referred_by, sizeof(sip_pvt->referred_by));
if (h_contact) {
ast_copy_string(sip_pvt->refer_contact, h_contact, sizeof(sip_pvt->refer_contact));
}