Przeglądaj źródła

modules_k/presence and modules_k/rls Fixed parse_to() usage

In case of error parse_to returns a pointer to the last parsed character. This is not a strict
error check, as several other modules provide a relaxed way of parsing To header (the uri is still
parseable even if the TO headers are not).
Marius Zbihlei 15 lat temu
rodzic
commit
957e2eb508
2 zmienionych plików z 4 dodań i 2 usunięć
  1. 2 1
      modules_k/presence/subscribe.c
  2. 2 1
      modules_k/rls/subscribe.c

+ 2 - 1
modules_k/presence/subscribe.c

@@ -798,7 +798,8 @@ int extract_sdialog_info(subs_t* subs,struct sip_msg* msg, int mexp,
 	else
 	else
 	{
 	{
 		memset( &TO , 0, sizeof(TO) );
 		memset( &TO , 0, sizeof(TO) );
-		if( !parse_to(msg->to->body.s,msg->to->body.s + msg->to->body.len + 1, &TO))
+		parse_to(msg->to->body.s,msg->to->body.s + msg->to->body.len + 1, &TO);
+		if( TO.uri.len <= 0 )
 		{
 		{
 			LM_DBG("'To' header NOT parsed\n");
 			LM_DBG("'To' header NOT parsed\n");
 			goto error;
 			goto error;

+ 2 - 1
modules_k/rls/subscribe.c

@@ -407,7 +407,8 @@ int rls_handle_subscribe(struct sip_msg* msg, char* s1, char* s2)
 	else
 	else
 	{
 	{
 		memset( &TO , 0, sizeof(TO) );
 		memset( &TO , 0, sizeof(TO) );
-		if( !parse_to(msg->to->body.s,msg->to->body.s+msg->to->body.len+1,&TO));
+		parse_to(msg->to->body.s,msg->to->body.s+msg->to->body.len+1,&TO);
+		if( TO.uri.len <= 0 )
 		{
 		{
 			LM_DBG("'To' header NOT parsed\n");
 			LM_DBG("'To' header NOT parsed\n");
 			goto error;
 			goto error;