Browse code

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.

Victor Seva authored on 09/09/2013 14:52:47
Showing 1 changed files
... ...
@@ -96,9 +96,12 @@ int get_redirect( struct sip_msg *msg , int maxt, int maxb,
96 96
 		}
97 97
 		if (max==0)
98 98
 			continue;
99
-		/* put the response code into the acc_param reason struct */
100
-		reason->code = t->uac[i].last_received;
101
-		reason->code_s.s = int2bstr((unsigned long)reason->code, code_buf, &reason->code_s.len);
99
+		if(reason!=NULL)
100
+		{
101
+			/* put the response code into the acc_param reason struct */
102
+			reason->code = t->uac[i].last_received;
103
+			reason->code_s.s = int2bstr((unsigned long)reason->code, code_buf, &reason->code_s.len);
104
+		}
102 105
 		/* get the contact from it */
103 106
 		n = shmcontact2dset( msg, t->uac[i].reply, max, reason, bflags);
104 107
 		if ( n<0 ) {