[sr-dev] git:4.0: registrar: reset r-uri pointer after backup in lookup_branches()
Daniel-Constantin Mierla
miconda at gmail.com
Wed Sep 4 23:01:44 CEST 2013
Module: sip-router
Branch: 4.0
Commit: 9c8fd38683d9f6531b0d6ee966d81d878095bf6a
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9c8fd38683d9f6531b0d6ee966d81d878095bf6a
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Wed Sep 4 22:59:13 2013 +0200
registrar: reset r-uri pointer after backup in lookup_branches()
- otherwise can be invalidated by next branch lookup
(cherry picked from commit 9b44e4b48862947f2ea634c6dd611ce7c07546a2)
---
modules/registrar/lookup.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/modules/registrar/lookup.c b/modules/registrar/lookup.c
index fcb6c26..f9bbad3 100644
--- a/modules/registrar/lookup.c
+++ b/modules/registrar/lookup.c
@@ -400,6 +400,11 @@ int lookup_branches(sip_msg_t *msg, udomain_t *d)
ruri_b_instance = msg->instance;
ruri_b_reg_id = msg->reg_id;
reset_ruri_branch(msg);
+ /* set new uri buf to null, otherwise is freed or overwritten by
+ * rewrite_uri() during branch lookup */
+ msg->new_uri.len=0;
+ msg->new_uri.s=0;
+ msg->parsed_uri_ok=0;
for(i=0; i<nr_branches_start; i++) {
crt = get_sip_branch(i);
@@ -469,7 +474,11 @@ int lookup_branches(sip_msg_t *msg, udomain_t *d)
done:
reset_ruri_branch(msg);
+ /* new uri could be set to allocated buffer by branch lookup */
+ if(msg->new_uri.s!=NULL)
+ pkg_free(msg->new_uri.s);
msg->new_uri = ruri_b_uri;
+ ruri_mark_new();
msg->parsed_uri_ok = 0;
msg->dst_uri = ruri_b_dst_uri;
msg->path_vec = ruri_b_path;
More information about the sr-dev
mailing list