Browse code

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

Henning Westerholt authored on 07/05/2018 07:36:53
Showing 1 changed files
... ...
@@ -2369,7 +2369,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2369 2369
 			case HDR_TO_T:
2370 2370
 				if (new_tag && new_tag->len) {
2371 2371
 					to_tag=get_to(msg)->tag_value;
2372
-					if ( to_tag.len || to_tag.s )
2372
+					if ( to_tag.len && to_tag.s )
2373 2373
 						len+=new_tag->len-to_tag.len;
2374 2374
 					else
2375 2375
 						len+=new_tag->len+TOTAG_TOKEN_LEN/*";tag="*/;
... ...
@@ -2497,7 +2497,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2497 2497
 				break;
2498 2498
 			case HDR_TO_T:
2499 2499
 				if (new_tag && new_tag->len){
2500
-					if (to_tag.s ) { /* replacement */
2500
+					if (to_tag.len && to_tag.s) { /* replacement */
2501 2501
 						/* before to-tag */
2502 2502
 						append_str( p, hdr->name.s, to_tag.s-hdr->name.s);
2503 2503
 						/* to tag replacement */