Module: kamailio Branch: master Commit: 3b1354e2fd26c06fa6bc5ddbee1a012507aa2ea5 URL: https://github.com/kamailio/kamailio/commit/3b1354e2fd26c06fa6bc5ddbee1a0125...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2022-08-12T09:16:24+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
---
Modified: src/modules/uac_redirect/uac_redirect.c
---
Diff: https://github.com/kamailio/kamailio/commit/3b1354e2fd26c06fa6bc5ddbee1a0125... Patch: https://github.com/kamailio/kamailio/commit/3b1354e2fd26c06fa6bc5ddbee1a0125...
---
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);