Module: kamailio Branch: 5.1 Commit: 9e239575dbee0a33beffe9a60a916dd99d9f364e URL: https://github.com/kamailio/kamailio/commit/9e239575dbee0a33beffe9a60a916dd9...
Author: Jeff Gross jeff@grosssoftware.com Committer: Henning Westerholt hw@skalatan.de Date: 2019-09-13T21:32:59+02:00
ims_isc: fixed the RURI trigger point match
- use the RURI from the SIP message in the regex compare, rather than the regex string from the trigger point
(cherry picked from commit 36ee7fa70ee43cffc8e7f2c279fb97862daf3f9b)
---
Modified: src/modules/ims_isc/checker.c
---
Diff: https://github.com/kamailio/kamailio/commit/9e239575dbee0a33beffe9a60a916dd9... Patch: https://github.com/kamailio/kamailio/commit/9e239575dbee0a33beffe9a60a916dd9...
---
diff --git a/src/modules/ims_isc/checker.c b/src/modules/ims_isc/checker.c index f02cf98bab..037d0507c7 100644 --- a/src/modules/ims_isc/checker.c +++ b/src/modules/ims_isc/checker.c @@ -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;