Hello,
during testing SER at SIPit 24 I discovered something what I believe is
a major bug in the To and From header parser of SER.
When you send a request with a To or From header like this:
To: <sip:nils@invalid.com>;foo
the To header parameter parser fails, and the whole To header is not parsed.
According to the BNF of 3261 generic parameters without parameters are
allowed in To and From header.
So I created the attached patch, which seems to work for me. Please
review carefully and let me know if I overlooked something in the
problem statement or the bug fix.
Cheers
Nils
Index: parse_to.c
===================================================================
RCS file: /cvsroot/ser/sip_router/parser/parse_to.c,v
retrieving revision 1.22
diff -a -u -r1.22 parse_to.c
--- parse_to.c 23 Jun 2008 17:09:57 -0000 1.22
+++ parse_to.c 20 May 2009 05:04:40 -0000
@@ -122,6 +122,11 @@
case TAG3:
param->type=TAG_PARAM;
case PARA_NAME:
+ param->value.len = tmp-param->value.s;
+ saved_status = E_PARA_VALUE;
+ status = F_LF;
+ add_param( param , to_b );
+ break;
case TAG1:
case TAG2:
param->name.len = tmp-param->name.s;
@@ -161,6 +166,11 @@
case TAG3:
param->type=TAG_PARAM;
case PARA_NAME:
+ param->name.len = tmp-param->name.s;
+ saved_status = E_PARA_VALUE;
+ status = F_CR;
+ add_param( param , to_b );
+ break;
case TAG1:
case TAG2:
param->name.len = tmp-param->name.s;
@@ -277,7 +287,13 @@
}
#endif
case PARA_VALUE_TOKEN:
- param->value.len=tmp-param->value.s;
+ case PARA_NAME:
+ if (status == PARA_VALUE_TOKEN) {
+ param->value.len=tmp-param->value.s;
+ }
+ else {
+ param->name.len = tmp-param->name.s;
+ }
add_param(param,to_b);
case E_PARA_VALUE:
param = (struct to_param*)