Module: kamailio
Branch: 5.6
Commit: e8947f9e2a52dbbf5e255785a15b502d74613071
URL:
https://github.com/kamailio/kamailio/commit/e8947f9e2a52dbbf5e255785a15b502…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)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/e8947f9e2a52dbbf5e255785a15b502…
Patch:
https://github.com/kamailio/kamailio/commit/e8947f9e2a52dbbf5e255785a15b502…
---
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);