2
0
Эх сурвалжийг харах

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 12 жил өмнө
parent
commit
abf0026782

+ 6 - 3
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 ) {