Browse Source

- safer handling of the 'received' Contact parameter

Jan Janak 21 years ago
parent
commit
1305057910
1 changed files with 7 additions and 4 deletions
  1. 7 4
      dset.c

+ 7 - 4
dset.c

@@ -166,10 +166,13 @@ int append_branch(struct sip_msg* msg, char* uri, int uri_len, char* dst_uri, in
 	branches[nr_branches].len = uri_len;
 	branches[nr_branches].q = q;
 	
-	if (dst_uri) {
-		memcpy(branches[nr_branches].dst_uri, dst_uri, dst_uri_len);
-		branches[nr_branches].dst_uri[dst_uri_len] = 0;
-		branches[nr_branches].dst_uri_len = dst_uri_len;
+ 	if (dst_uri && dst_uri_len) {
+  		memcpy(branches[nr_branches].dst_uri, dst_uri, dst_uri_len);
+  		branches[nr_branches].dst_uri[dst_uri_len] = 0;
+  		branches[nr_branches].dst_uri_len = dst_uri_len;
+ 	} else {
+ 		branches[nr_branches].dst_uri[0] = '\0';
+ 		branches[nr_branches].dst_uri_len = 0;
 	}
 
 	nr_branches++;