Module: sip-router
Branch: master
Commit: cea9b91dacdb23b22fc1a7dd8454994eab9efa6e
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cea9b91…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Oct 10 12:11:52 2014 +0200
tm: safety check for user_agent_header value
- don't add the header in local generated requests if the value is empty
---
modules/tm/t_msgbuilder.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/tm/t_msgbuilder.c b/modules/tm/t_msgbuilder.c
index fae0cdf..bcf96c5 100644
--- a/modules/tm/t_msgbuilder.c
+++ b/modules/tm/t_msgbuilder.c
@@ -1578,9 +1578,9 @@ char* build_uac_req(str* method, str* headers, str* body, dlg_t*
dialog, int bra
*len += CSEQ_LEN + cseq.len + 1 + method->len + CRLF_LEN;
/* CSeq */
*len += calculate_routeset_length(dialog);
/* Route set */
*len += maxfwd_len;
/* Max-forwards */
- *len += CONTENT_LENGTH_LEN + content_length.len + CRLF_LEN; /* Content-
- Length */
- *len += (server_signature ? (user_agent_hdr.len + CRLF_LEN) : 0);
/* Signature */
+ *len += CONTENT_LENGTH_LEN + content_length.len + CRLF_LEN; /* Content-Length */
+ *len += ((server_signature && user_agent_hdr.len>0)
+ ? (user_agent_hdr.len + CRLF_LEN) : 0); /* Signature */
*len += (headers ? headers->len : 0);
/* Additional headers */
*len += (body ? body->len : 0);
/* Message body */
*len += CRLF_LEN;
/* End of Header */
@@ -1610,13 +1610,13 @@ char* build_uac_req(str* method, str* headers, str* body, dlg_t*
dialog, int bra
memapp(w, CRLF, CRLF_LEN);
/* Server signature */
- if (server_signature) {
+ if (server_signature && user_agent_hdr.len>0) {
memapp(w, user_agent_hdr.s, user_agent_hdr.len);
memapp(w, CRLF, CRLF_LEN);
}
if (headers) memapp(w, headers->s, headers->len);
memapp(w, CRLF, CRLF_LEN);
- if (body) memapp(w, body->s, body->len);
+ if (body) memapp(w, body->s, body->len);
#ifdef EXTRA_DEBUG
assert(w-buf == *len);