Module: sip-router
Branch: master
Commit: 14183ffa5e1bab1659d1df87a77057d50c376029
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=14183ff…
Author: Alekzander Spiridonov <sipidronov(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Sep 4 07:09:02 2014 -0700
msg_parser: fix To parameter with null value parsing
---
msg_translator.c | 2 +-
parser/parse_addr_spec.c | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/msg_translator.c b/msg_translator.c
index 788cff8..677d44e 100644
--- a/msg_translator.c
+++ b/msg_translator.c
@@ -2406,7 +2406,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 )
+ if ( to_tag.len || to_tag.s )
len+=new_tag->len-to_tag.len;
else
len+=new_tag->len+TOTAG_TOKEN_LEN/*";tag="*/;
diff --git a/parser/parse_addr_spec.c b/parser/parse_addr_spec.c
index c6635d3..f0388a2 100644
--- a/parser/parse_addr_spec.c
+++ b/parser/parse_addr_spec.c
@@ -546,7 +546,12 @@ endofheader:
break;
case S_PARA_VALUE:
/* parameter with null value, e.g. foo= */
- param->value.s=tmp;
+ if ( status==F_CRLF )
+ param->value.s=tmp-2;
+ else if ( status==F_CR || status==F_LF )
+ param->value.s=tmp-1;
+ else
+ param->value.s=tmp;
param->value.len=0;
add_param(param, to_b, newparam);
saved_status=E_PARA_VALUE;