Browse code

core: select - test for HDR_ERROR_T after header name parsing

Daniel-Constantin Mierla authored on 03/06/2021 08:55:22
Showing 1 changed files
... ...
@@ -595,7 +595,7 @@ int select_msg_header(str* res, select_t* s, struct sip_msg* msg)
595 595
 {
596 596
 	/* get all headers */
597 597
 	char *c;
598
-	res->s = SIP_MSG_START(msg) + msg->first_line.len; 
598
+	res->s = SIP_MSG_START(msg) + msg->first_line.len;
599 599
 	c = get_body(msg);
600 600
 	res->len = c - res->s;
601 601
 	return 0;
... ...
@@ -607,7 +607,7 @@ int select_anyheader(str* res, select_t* s, struct sip_msg* msg)
607 607
 	int hi;
608 608
 	char c;
609 609
 	struct hdr_field hdr;
610
-	
610
+
611 611
 	if(msg==NULL) {
612 612
 		if (res!=NULL) return -1;
613 613
 
... ...
@@ -622,13 +622,15 @@ int select_anyheader(str* res, select_t* s, struct sip_msg* msg)
622 622
 				/* if header name is parseable, parse it and set SEL_PARAM_DIV */
623 623
 			c=s->params[2].v.s.s[s->params[2].v.s.len];
624 624
 			s->params[2].v.s.s[s->params[2].v.s.len]=':';
625
-			if (parse_hname2_short(s->params[2].v.s.s,s->params[2].v.s.s+(s->params[2].v.s.len<3?4:s->params[2].v.s.len+1),
626
-						&hdr)==0) {
625
+			parse_hname2_short(s->params[2].v.s.s,s->params[2].v.s.s
626
+					+(s->params[2].v.s.len<3?4:s->params[2].v.s.len+1),
627
+						&hdr);
628
+			if(hdr.type==HDR_ERROR_T) {
627 629
 				LM_ERR("fixup_call:parse error\n");
628 630
 				return -1;
629 631
 			}
630 632
 			s->params[2].v.s.s[s->params[2].v.s.len]=c;
631
-			
633
+
632 634
 			if (hdr.type!=HDR_OTHER_T && hdr.type!=HDR_ERROR_T) {
633 635
 				/* pkg_free(s->params[1].v.s.s); */
634 636
 				/* don't free it (the mem can leak only once at startup)