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

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


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

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.
(cherry picked from commit abf0026782c0ba4643feb25ded022e8c12725584)

---

 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 19b4dad..d1e4d46 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