[sr-dev] git:master:36ee7fa7: ims_isc: fixed the RURI trigger point match

Henning Westerholt hw at skalatan.de
Fri Sep 13 21:30:28 CEST 2019


Module: kamailio
Branch: master
Commit: 36ee7fa70ee43cffc8e7f2c279fb97862daf3f9b
URL: https://github.com/kamailio/kamailio/commit/36ee7fa70ee43cffc8e7f2c279fb97862daf3f9b

Author: Jeff Gross <jeff at grosssoftware.com>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-09-13T21:30:23+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

---

Modified: src/modules/ims_isc/checker.c

---

Diff:  https://github.com/kamailio/kamailio/commit/36ee7fa70ee43cffc8e7f2c279fb97862daf3f9b.diff
Patch: https://github.com/kamailio/kamailio/commit/36ee7fa70ee43cffc8e7f2c279fb97862daf3f9b.patch

---

diff --git a/src/modules/ims_isc/checker.c b/src/modules/ims_isc/checker.c
index 07381c79ab..de325687c0 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;




More information about the sr-dev mailing list