diff options
author | Mark Spencer <markster@digium.com> | 2004-02-09 05:38:17 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2004-02-09 05:38:17 +0000 |
commit | e1df8c9082cd72e83d474d38cd0ccf2aa9d81650 (patch) | |
tree | fb05914be135616ced992c2f829c8bf3d9855693 /channels | |
parent | 02f99cb6318a3ec98dbd85d74bd10e747534b529 (diff) |
Properly fully URL decode the REPLACES in SIP and also watch for edge condition (bug #1015)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2142 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_sip.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 6df1f5344..f97700ccb 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3958,11 +3958,15 @@ static int get_refer_info(struct sip_pvt *p, struct sip_request *oreq) a++; if (!strncasecmp(a, "REPLACES=", strlen("REPLACES="))) { strncpy(tmp5, a + strlen("REPLACES="), sizeof(tmp5) - 1); - if ((a = strchr(tmp5, '%'))) { + a = tmp5; + while ((a = strchr(a, '%'))) { /* Yuck! Pingtel converts the '@' to a %40, icky icky! Convert back to an '@' */ + if (strlen(a) < 3) + break; *a = hex2int(a[1]) * 16 + hex2int(a[2]); memmove(a + 1, a+3, strlen(a + 3) + 1); + a++; } if ((a = strchr(tmp5, '%'))) *a = '\0'; |