Browse code

msg_parser: fix To parameter with null value parsing

Alekzander Spiridonov authored on 04/09/2014 14:09:02
Showing 2 changed files
... ...
@@ -2406,7 +2406,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2406 2406
 			case HDR_TO_T:
2407 2407
 				if (new_tag && new_tag->len) {
2408 2408
 					to_tag=get_to(msg)->tag_value;
2409
-					if (to_tag.len )
2409
+					if ( to_tag.len || to_tag.s )
2410 2410
 						len+=new_tag->len-to_tag.len;
2411 2411
 					else
2412 2412
 						len+=new_tag->len+TOTAG_TOKEN_LEN/*";tag="*/;
... ...
@@ -546,7 +546,12 @@ endofheader:
546 546
 			break;
547 547
 		case S_PARA_VALUE:
548 548
 			/* parameter with null value, e.g. foo= */
549
-			param->value.s=tmp;
549
+			if ( status==F_CRLF )
550
+				param->value.s=tmp-2;
551
+			else if ( status==F_CR || status==F_LF )
552
+				param->value.s=tmp-1;
553
+			else
554
+				param->value.s=tmp;
550 555
 			param->value.len=0;
551 556
 			add_param(param, to_b, newparam);
552 557
 			saved_status=E_PARA_VALUE;