Handle URL encoded stuff in pedantic checking

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3303 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-06-25 18:23:06 +00:00
parent d37b6dd459
commit fe4b2401bd

View File

@@ -866,6 +866,30 @@ static int send_request(struct sip_pvt *p, struct sip_request *req, int reliable
return res;
}
static void url_decode(char *s)
{
char *o = s;
unsigned int tmp;
while(*s) {
switch(*s) {
case '%':
if (strlen(s) > 2) {
if (sscanf(s + 1, "%2x", &tmp) == 1) {
*o = tmp;
s += 2; /* Will be incremented once more when we break out */
break;
}
}
/* Fall through if something wasn't right with the formatting */
default:
*o = *s;
}
s++;
o++;
}
*o = '\0';
}
/*--- ditch_braces: Pick out text in braces from character string ---*/
static char *ditch_braces(char *tmp)
{
@@ -4656,6 +4680,8 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
} else
strncpy(p->fromdomain, fr, sizeof(p->fromdomain) - 1);
}
if (pedanticsipchecking)
url_decode(c);
if (sip_debug_test_pvt(p))
ast_verbose("Looking for %s in %s\n", c, p->context);
if (ast_exists_extension(NULL, p->context, c, 1, fr) ||