[sr-dev] git:master: uac_redirect: get_redirect() check reason value before using it .

Victor Seva linuxmaniac at torreviejawireless.org
Tue Sep 10 09:23:21 CEST 2013


Module: sip-router
Branch: master
Commit: abf0026782c0ba4643feb25ded022e8c12725584
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=abf0026782c0ba4643feb25ded022e8c12725584

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date:   Mon Sep  9 16:52:47 2013 +0200

uac_redirect: get_redirect() check reason value before using it.

This fix a core dump when get_redirects() config fuction is called with just
the one parameter.

---

 modules/uac_redirect/rd_funcs.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/uac_redirect/rd_funcs.c b/modules/uac_redirect/rd_funcs.c
index ca34e0c..aa8dbd0 100644
--- a/modules/uac_redirect/rd_funcs.c
+++ b/modules/uac_redirect/rd_funcs.c
@@ -96,9 +96,12 @@ int get_redirect( struct sip_msg *msg , int maxt, int maxb,
 		}
 		if (max==0)
 			continue;
-		/* put the response code into the acc_param reason struct */
-		reason->code = t->uac[i].last_received;
-		reason->code_s.s = int2bstr((unsigned long)reason->code, code_buf, &reason->code_s.len);
+		if(reason!=NULL)
+		{
+			/* put the response code into the acc_param reason struct */
+			reason->code = t->uac[i].last_received;
+			reason->code_s.s = int2bstr((unsigned long)reason->code, code_buf, &reason->code_s.len);
+		}
 		/* get the contact from it */
 		n = shmcontact2dset( msg, t->uac[i].reply, max, reason, bflags);
 		if ( n<0 ) {




More information about the sr-dev mailing list