[sr-dev] git:master:25834469: core: select - test for HDR_ERROR_T after header name parsing

Daniel-Constantin Mierla miconda at gmail.com
Thu Jun 3 10:55:59 CEST 2021


Module: kamailio
Branch: master
Commit: 2583446968d81a9351caab1cfdd2cc86434850f3
URL: https://github.com/kamailio/kamailio/commit/2583446968d81a9351caab1cfdd2cc86434850f3

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-03T10:55:22+02:00

core: select - test for HDR_ERROR_T after header name parsing

---

Modified: src/core/select_core.c

---

Diff:  https://github.com/kamailio/kamailio/commit/2583446968d81a9351caab1cfdd2cc86434850f3.diff
Patch: https://github.com/kamailio/kamailio/commit/2583446968d81a9351caab1cfdd2cc86434850f3.patch

---

diff --git a/src/core/select_core.c b/src/core/select_core.c
index 029f880a48..02d393a6ba 100644
--- a/src/core/select_core.c
+++ b/src/core/select_core.c
@@ -595,7 +595,7 @@ int select_msg_header(str* res, select_t* s, struct sip_msg* msg)
 {
 	/* get all headers */
 	char *c;
-	res->s = SIP_MSG_START(msg) + msg->first_line.len; 
+	res->s = SIP_MSG_START(msg) + msg->first_line.len;
 	c = get_body(msg);
 	res->len = c - res->s;
 	return 0;
@@ -607,7 +607,7 @@ int select_anyheader(str* res, select_t* s, struct sip_msg* msg)
 	int hi;
 	char c;
 	struct hdr_field hdr;
-	
+
 	if(msg==NULL) {
 		if (res!=NULL) return -1;
 
@@ -622,13 +622,15 @@ int select_anyheader(str* res, select_t* s, struct sip_msg* msg)
 				/* if header name is parseable, parse it and set SEL_PARAM_DIV */
 			c=s->params[2].v.s.s[s->params[2].v.s.len];
 			s->params[2].v.s.s[s->params[2].v.s.len]=':';
-			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),
-						&hdr)==0) {
+			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),
+						&hdr);
+			if(hdr.type==HDR_ERROR_T) {
 				LM_ERR("fixup_call:parse error\n");
 				return -1;
 			}
 			s->params[2].v.s.s[s->params[2].v.s.len]=c;
-			
+
 			if (hdr.type!=HDR_OTHER_T && hdr.type!=HDR_ERROR_T) {
 				/* pkg_free(s->params[1].v.s.s); */
 				/* don't free it (the mem can leak only once at startup)




More information about the sr-dev mailing list