[sr-dev] git:master:785bbaa0: core: kemi - check hdr type HDR_ERROR_T after parsing

Daniel-Constantin Mierla miconda at gmail.com
Wed Jun 2 19:00:34 CEST 2021


Module: kamailio
Branch: master
Commit: 785bbaa0f16f83353ad1d776816f439608a67858
URL: https://github.com/kamailio/kamailio/commit/785bbaa0f16f83353ad1d776816f439608a67858

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-02T18:57:53+02:00

core: kemi - check hdr type HDR_ERROR_T after parsing

---

Modified: src/core/kemi.c

---

Diff:  https://github.com/kamailio/kamailio/commit/785bbaa0f16f83353ad1d776816f439608a67858.diff
Patch: https://github.com/kamailio/kamailio/commit/785bbaa0f16f83353ad1d776816f439608a67858.patch

---

diff --git a/src/core/kemi.c b/src/core/kemi.c
index 324e7cd6cf..bee8a98f07 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -1988,7 +1988,8 @@ static int sr_kemi_hdr_append_after(sip_msg_t *msg, str *txt, str *hname)
 	hbuf[hname->len] = ':';
 	hbuf[hname->len+1] = '\0';
 
-	if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
+	parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
+	if(hfm.type==HDR_ERROR_T) {
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
 		return -1;
 	}
@@ -2056,7 +2057,8 @@ int sr_kemi_hdr_remove(sip_msg_t *msg, str *hname)
 	hbuf[hname->len] = ':';
 	hbuf[hname->len+1] = '\0';
 
-	if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
+	parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
+	if(hfm.type==HDR_ERROR_T) {
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
 		return -1;
 	}
@@ -2106,7 +2108,8 @@ static int sr_kemi_hdr_is_present(sip_msg_t *msg, str *hname)
 	hbuf[hname->len] = ':';
 	hbuf[hname->len+1] = '\0';
 
-	if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
+	parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
+	if(hfm.type==HDR_ERROR_T) {
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
 		return -1;
 	}
@@ -2188,7 +2191,8 @@ static int sr_kemi_hdr_insert_before(sip_msg_t *msg, str *txt, str *hname)
 	hbuf[hname->len] = ':';
 	hbuf[hname->len+1] = '\0';
 
-	if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
+	parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
+	if(hfm.type==HDR_ERROR_T) {
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
 		return -1;
 	}
@@ -2305,7 +2309,8 @@ static sr_kemi_xval_t* sr_kemi_hdr_get_mode(sip_msg_t *msg, str *hname, int idx,
 		sr_kemi_xval_null(&_sr_kemi_xval, rmode);
 		return &_sr_kemi_xval;
 	}
-	if (parse_hname2_str(hname, &shdr)==0) {
+	parse_hname2_str(hname, &shdr);
+	if(shdr.type==HDR_ERROR_T) {
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
 		sr_kemi_xval_null(&_sr_kemi_xval, rmode);
 		return &_sr_kemi_xval;
@@ -2426,7 +2431,8 @@ static int sr_kemi_hdr_match_content(sip_msg_t *msg, str *hname, str *op,
 		return SR_KEMI_FALSE;
 	}
 
-	if (parse_hname2_str(hname, &hfm)==0) {
+	parse_hname2_str(hname, &hfm);
+	if(hfm.type==HDR_ERROR_T) {
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
 		return SR_KEMI_FALSE;
 	}




More information about the sr-dev mailing list