- safer handling of the 'received' Contact parameter
authorJan Janak <jan@iptel.org>
Sun, 14 Nov 2004 22:30:32 +0000 (22:30 +0000)
committerJan Janak <jan@iptel.org>
Sun, 14 Nov 2004 22:30:32 +0000 (22:30 +0000)
dset.c

diff --git a/dset.c b/dset.c
index d7c588c..340d0a6 100644 (file)
--- a/dset.c
+++ b/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++;