Skip to content

Commit

Permalink
ims_isc: fixed the RURI trigger point match
Browse files Browse the repository at this point in the history
- use the RURI from the SIP message in the regex compare, rather
  than the regex string from the trigger point

(cherry picked from commit 36ee7fa)
  • Loading branch information
grosssoftware authored and henningw committed Sep 13, 2019
1 parent f7ad4bd commit c6eab37
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/modules/ims_isc/checker.c
Expand Up @@ -189,22 +189,30 @@ static int isc_check_session_desc(ims_spt *spt, struct sip_msg *msg) {
*/
static int isc_check_ruri(ims_spt *spt, struct sip_msg *msg) {
char buf[256];
char buf2[256];
regex_t comp;

if (spt->request_uri.len >= sizeof(buf)) {
LM_ERR("RURI \"%.*s\" is to long to be processed (max %d bytes)\n", spt->request_uri.len, spt->request_uri.s, (int) (sizeof(buf) - 1));
LM_ERR("RURI regexp \"%.*s\" is too long to be compiled (max %d bytes)\n", spt->request_uri.len, spt->request_uri.s, (int) (sizeof(buf) - 1));
return FALSE;
}

if (msg->first_line.u.request.uri.len >= sizeof(buf2)) {
LM_ERR("RURI \"%.*s\" is too long to be processed (max %d bytes)\n", msg->first_line.u.request.uri.len, msg->first_line.u.request.uri.s, (int) (sizeof(buf2) - 1));
return FALSE;
}

/* compile the regex for content */
memcpy(buf, spt->request_uri.s, spt->request_uri.len);
buf[spt->request_uri.len] = 0;
if(regcomp(&(comp), buf, REG_ICASE | REG_EXTENDED) != 0) {
if (regcomp(&(comp), buf, REG_ICASE | REG_EXTENDED) != 0) {
LM_ERR("Error compiling the following regexp for RURI content: %.*s\n", spt->request_uri.len, spt->request_uri.s);
return FALSE;
}

if (regexec(&(comp), buf, 0, NULL, 0) == 0) //regex match
memcpy(buf2, msg->first_line.u.request.uri.s, msg->first_line.u.request.uri.len);
buf2[msg->first_line.u.request.uri.len] = 0;
if (regexec(&(comp), buf2, 0, NULL, 0) == 0) //regex match
{
regfree(&(comp));
return TRUE;
Expand Down

0 comments on commit c6eab37

Please sign in to comment.