[sr-dev] git:5.6:e8947f9e: uac_redirect: check if reason parameter ifs provided for get_redirects()

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 16 12:01:26 CEST 2022


Module: kamailio
Branch: 5.6
Commit: e8947f9e2a52dbbf5e255785a15b502d74613071
URL: https://github.com/kamailio/kamailio/commit/e8947f9e2a52dbbf5e255785a15b502d74613071

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-08-16T12:00:04+02:00

uac_redirect: check if reason parameter ifs provided for get_redirects()

- cope properly with the common function used for the two function
  variants
- GH #3197

(cherry picked from commit 3b1354e2fd26c06fa6bc5ddbee1a012507aa2ea5)

---

Modified: src/modules/uac_redirect/uac_redirect.c

---

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

---

diff --git a/src/modules/uac_redirect/uac_redirect.c b/src/modules/uac_redirect/uac_redirect.c
index 76b7592b5a..9925621d0e 100644
--- a/src/modules/uac_redirect/uac_redirect.c
+++ b/src/modules/uac_redirect/uac_redirect.c
@@ -344,17 +344,19 @@ static int w_get_redirect2(struct sip_msg* msg, char *max_c, char *reason)
 {
 	int n;
 	unsigned short max;
-	str sreason;
+	str sreason = {0};
 
-	if(fixup_get_svalue(msg, (gparam_t*)reason, &sreason)<0) {
-		LM_ERR("failed to get reason parameter\n");
-		return -1;
+	if(reason!=NULL) {
+		if(fixup_get_svalue(msg, (gparam_t*)reason, &sreason)<0) {
+			LM_ERR("failed to get reason parameter\n");
+			return -1;
+		}
 	}
 
 	msg_tracer( msg, 0);
 	/* get the contacts */
 	max = (unsigned short)(long)max_c;
-	n = get_redirect(msg , (max>>8)&0xff, max&0xff, &sreason, bflags);
+	n = get_redirect(msg , (max>>8)&0xff, max&0xff, (reason)?&sreason:NULL, bflags);
 	reset_filters();
 	/* reset the tracer */
 	msg_tracer( msg, 1);




More information about the sr-dev mailing list