Browse Source

uac: safe initialization of vars and debug message for uac_replace_to()

Daniel-Constantin Mierla 11 years ago
parent
commit
a7251ba414
2 changed files with 6 additions and 5 deletions
  1. 0 1
      modules/uac/replace.c
  2. 6 4
      modules/uac/uac.c

+ 0 - 1
modules/uac/replace.c

@@ -470,7 +470,6 @@ int replace_uri( struct sip_msg *msg, str *display, str *uri,
 		p += rr_param->len;
 		*(p++) = '=';
 		memcpy( p, replace.s, replace.len);
-		p += replace.len;
 
 		if (uac_rrb.add_rr_param( msg, &param)!=0)
 		{

+ 6 - 4
modules/uac/uac.c

@@ -432,8 +432,8 @@ int w_replace_from(struct sip_msg* msg, char* p1, char* p2)
 {
 	str uri_s;
 	str dsp_s;
-	str *uri;
-	str *dsp;
+	str *uri = NULL;
+	str *dsp = NULL;
 
 	if (p2==NULL) {
 		 p2 = p1;
@@ -499,8 +499,8 @@ static int w_replace_to(struct sip_msg* msg, char* p1, char* p2)
 {
 	str uri_s;
 	str dsp_s;
-	str *uri;
-	str *dsp;
+	str *uri = NULL;
+	str *dsp = NULL;
 
 	if (p2==NULL) {
 		p2 = p1;
@@ -527,6 +527,8 @@ static int w_replace_to(struct sip_msg* msg, char* p1, char* p2)
 		return -1;
 	}
 
+	LM_DBG("dsp=%p (len=%d) , uri=%p (len=%d)\n",dsp,dsp?dsp->len:0,uri,uri?uri->len:0);
+
 	return (replace_uri(msg, dsp, uri, msg->to, &rr_to_param, &restore_to_avp, 0)==0)?1:-1;
 
 }