[sr-dev] git:5.1:03dd5924: core: improve to header check guards, str consists of length and pointer

Henning Westerholt hw at kamailio.org
Mon May 7 20:20:59 CEST 2018


Module: kamailio
Branch: 5.1
Commit: 03dd59249d17c55c749d4a4e806843f7f407e4ea
URL: https://github.com/kamailio/kamailio/commit/03dd59249d17c55c749d4a4e806843f7f407e4ea

Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2018-05-07T20:20:49+02:00

core: improve to header check guards, str consists of length and pointer

(cherry picked from commit 281a6c6b6eaaf30058b603325e8ded20b99e1456)

---

Modified: src/core/msg_translator.c

---

Diff:  https://github.com/kamailio/kamailio/commit/03dd59249d17c55c749d4a4e806843f7f407e4ea.diff
Patch: https://github.com/kamailio/kamailio/commit/03dd59249d17c55c749d4a4e806843f7f407e4ea.patch

---

diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c
index ca0f9fa521..201e3a5e1d 100644
--- a/src/core/msg_translator.c
+++ b/src/core/msg_translator.c
@@ -2367,7 +2367,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
 			case HDR_TO_T:
 				if (new_tag && new_tag->len) {
 					to_tag=get_to(msg)->tag_value;
-					if ( to_tag.len || to_tag.s )
+					if ( to_tag.len && to_tag.s )
 						len+=new_tag->len-to_tag.len;
 					else
 						len+=new_tag->len+TOTAG_TOKEN_LEN/*";tag="*/;
@@ -2495,7 +2495,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
 				break;
 			case HDR_TO_T:
 				if (new_tag && new_tag->len){
-					if (to_tag.s ) { /* replacement */
+					if (to_tag.len && to_tag.s) { /* replacement */
 						/* before to-tag */
 						append_str( p, hdr->name.s, to_tag.s-hdr->name.s);
 						/* to tag replacement */




More information about the sr-dev mailing list